Example #1
0
 def __init__(self,
              model,
              name,
              short_description=None,
              text=len,
              default="",
              template_name=None,
              extra_context=None):
     ChangeListTemplateColumn.__init__(self, short_description,
                                       template_name or self.template_name,
                                       extra_context)
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     if self.direct:
         self.to_model = self.field.related.parent_model
         self.to_opts = self.to_model._meta
         self.reverse_name = self.field.rel.related_name
         self.rel_name = self.opts.pk.name
     else:
         self.to_model = self.field.model
         self.to_opts = self.field.opts
         self.reverse_name = self.field.name
         if self.m2m:
             self.rel_name = self.field.rel.get_related_field().name
         else:
             self.rel_name = self.field.rel.field_name
     self.text = text
Example #2
0
 def __init__(self, model, name, short_description=None, default="",
              target='_blank', classes='external'):
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     self.target = target
     if isinstance(classes, basestring):
         classes = classes.split()
     self.classes = list(classes)
Example #3
0
 def __init__(self, model, name, short_description=None, default="", template_name=None, extra_context=None):
     ChangeListTemplateColumn.__init__(
         self, short_description, template_name or self.template_name, extra_context, name
     )
     ChangeListModelFieldColumn.__init__(self, model, name, short_description, default)
     self.to_model = self.field.rel.to
     self.to_opts = self.to_model._meta
     self.to_field = self.field.rel.field_name
Example #4
0
 def __init__(self,
              model,
              name,
              max_length,
              short_description=None,
              default="",
              tail=u"…"):
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     self.max_length = max_length
     self.tail = tail
Example #5
0
 def __init__(self,
              model,
              name,
              short_description=None,
              default="",
              target='_blank',
              classes='external'):
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     self.target = target
     if isinstance(classes, basestring):
         classes = classes.split()
     self.classes = list(classes)
Example #6
0
 def __init__(self,
              model,
              name,
              short_description=None,
              default="",
              template_name=None,
              extra_context=None):
     ChangeListTemplateColumn.__init__(self, short_description,
                                       template_name or self.template_name,
                                       extra_context, name)
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     self.to_model = self.field.rel.to
     self.to_opts = self.to_model._meta
     self.to_field = self.field.rel.field_name
Example #7
0
 def __init__(self, model, name, short_description=None, default="", sep=", "):
     ChangeListModelFieldColumn.__init__(self, model, name, short_description, default)
     if self.direct:
         self.to_model = self.field.related.parent_model
         self.to_opts = self.to_model._meta
         self.reverse_name = self.field.rel.related_name
         self.rel_name = self.opts.pk.name
     else:
         self.to_model = self.field.model
         self.to_opts = self.field.opts
         self.reverse_name = self.field.name
         if self.m2m:
             self.rel_name = self.field.rel.get_related_field().name
         else:
             self.rel_name = self.field.rel.field_name
     self.sep = sep
Example #8
0
 def __init__(
     self, model, name, short_description=None, text=len, default="", template_name=None, extra_context=None
 ):
     ChangeListTemplateColumn.__init__(self, short_description, template_name or self.template_name, extra_context)
     ChangeListModelFieldColumn.__init__(self, model, name, short_description, default)
     if self.direct:
         self.to_model = self.field.related.parent_model
         self.to_opts = self.to_model._meta
         self.reverse_name = self.field.rel.related_name
         self.rel_name = self.opts.pk.name
     else:
         self.to_model = self.field.model
         self.to_opts = self.field.opts
         self.reverse_name = self.field.name
         if self.m2m:
             self.rel_name = self.field.rel.get_related_field().name
         else:
             self.rel_name = self.field.rel.field_name
     self.text = text
Example #9
0
 def __init__(self,
              model,
              name,
              short_description=None,
              default="",
              sep=", "):
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     if self.direct:
         self.to_model = self.field.related.parent_model
         self.to_opts = self.to_model._meta
         self.reverse_name = self.field.rel.related_name
         self.rel_name = self.opts.pk.name
     else:
         self.to_model = self.field.model
         self.to_opts = self.field.opts
         self.reverse_name = self.field.name
         if self.m2m:
             self.rel_name = self.field.rel.get_related_field().name
         else:
             self.rel_name = self.field.rel.field_name
     self.sep = sep
Example #10
0
 def __init__(self, model, name, max_length, short_description=None,
              default="", tail=u"…"):
     ChangeListModelFieldColumn.__init__(self, model, name,
                                         short_description, default)
     self.max_length = max_length
     self.tail = tail