Exemplo n.º 1
 def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
   description=None, model_admin=None, inlines=None):
     self.inlines = inlines
     if not inlines:
         for field in fields:
             if is_inline(field):
                 # an inline is in the field list, but the list of inlines is empty
     super(OrderedFieldset, self).__init__(form, name, readonly_fields, fields, classes, description, model_admin)
Exemplo n.º 2
 def __iter__(self):
     for field in self.fields:
         if not is_inline(field):
             fieldline = helpers.Fieldline(self.form, field, self.readonly_fields, model_admin=self.model_admin)
             elem = OrderedElement(fieldline=fieldline)
             yield elem
             field = decode_inline(field)
             for inline in self.inlines:
                 if hasattr(inline.opts, 'parent_fk_name'):
                     if inline.opts.parent_fk_name == field:
                         elem = OrderedElement(inline=inline)
                         yield elem
                 elif hasattr(inline.formset, 'prefix'):
                     if inline.formset.prefix == field:
                         elem = OrderedElement(inline=inline)
                         yield elem
                     raise InlineError('Incorrect inline: no opts.parent_fk_name or formset.prefix found')