Edited deprecated code

Fixes #449

See : https://docs.djangoproject.com/en/3.2/ref/forms/api/\#notes-on-field-ordering
This commit is contained in:
Théo DURR 2022-08-26 22:33:21 +02:00
parent 997fcc9fff
commit 142cb3316e
No known key found for this signature in database
GPG Key ID: 708858E9F7281E30

View File

@ -68,9 +68,17 @@ class SubscriptionForm(forms.ModelForm):
) )
self.fields["email"] = forms.EmailField() self.fields["email"] = forms.EmailField()
self.fields["date_of_birth"] = forms.DateTimeField(widget=SelectDate) self.fields["date_of_birth"] = forms.DateTimeField(widget=SelectDate)
self.fields.move_to_end("subscription_type")
self.fields.move_to_end("payment_method") self.field_order = [
self.fields.move_to_end("location") "member",
"last_name",
"first_name",
"email",
"date_of_birth",
"subscription_type",
"payment_method",
"location",
]
def clean_member(self): def clean_member(self):
subscriber = self.cleaned_data.get("member") subscriber = self.cleaned_data.get("member")