class D(A, B, C):
pass
class B(B1, B2):
pass
{% for d in forms.myforms %}
{% for field in d.form.visible_fields %}
{% endfor %}
{% endfor %}
Hi Justin,
Something that caught my eye is {% for d in forms.myforms %}. If you have one form, D, then I don’t think you should need to loop through the other forms.
After saying that, it does look like there was a change in field order in Django 1.7.
See https://github.com/pennersr/django-allauth/issues/356#issuecomment-24758824.
See also this Stack Overflow post for a similar discussion:
http://stackoverflow.com/questions/913589/django-forms-inheritance-and-order-of-form-fields
If you upgrade Django 1.9, you can utilize the field_order attribute on the Form class to specify the order of the fields:
https://docs.djangoproject.com/en/1.10/ref/forms/api/#notes-on-field-ordering
And you may want to consider using Django-crispy-forms for form rendering:
https://github.com/django-crispy-forms/django-crispy-forms
Thank you,
Matthew
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
django-users...@googlegroups.com.
To post to this group, send email to
django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/8caa622b-5cf2-4869-aa0f-a7aa68a3b50f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# Walk through the MRO.
declared_fields = OrderedDict()
for base in reversed(new_class.__mro__):
# Collect fields from base class.
if hasattr(base, 'declared_fields'):
declared_fields.update(base.declared_fields)"reverse(new_class.__mro__)" is causing order of inherited forms to be reversed.DeclarativeFieldsMetaclass was reworked for version 1.7 and I don't know what the intended behavior is so I am not opening a ticket.I tested with two unrelated Django applications and I found the same results in both.