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


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Justin J
Sent: Monday, January 9, 2017 11:18 AM
To: Django users
Subject: Form Inheritance. Order is Reversed.

I have a form which is sublassing 3 forms, and has no new fields.

class D(A, B, C):
    pass

form class B is subclassing 2 forms.

class B(B1, B2):
    pass


In the template I am looping through the form.

{% for d in forms.myforms %}
    {% for field in d.form.visible_fields %}

    {% endfor %}
{% endfor %}


This was working as expected until recently. Form classes A, B, C are displayed 
in reverse order now, and B1, B2 are also reversed. However, fields within B2 
are still in the order declared.

The only thing I can think of that changed recently was an upgrade from Django 
1.5 to 1.8. I have no clue if it is related.

Anyone experience this before?

Thanks for any suggestions.


--
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+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@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<https://groups.google.com/d/msgid/django-users/8caa622b-5cf2-4869-aa0f-a7aa68a3b50f%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/cd164bbfd9dc4324bd2171d814ba0246%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to