can we use clean method instead of __init__
On Mon 5 Nov, 2018, 4:47 PM Aashutosh Rathi,
wrote:
> Yes, this works for me.
> Make sure
>
>
> super(AddLabForm, self).__init__(*args, **kwargs)
>fields_keyOrder = ['id', 'date', 'start_time', 'end_time']
>if 'keyOrder' in
Yes, this works for me.
Make sure
super(AddLabForm, self).__init__(*args, **kwargs)
fields_keyOrder = ['id', 'date', 'start_time', 'end_time']
if 'keyOrder' in self.fields:
self.fields.keyOrder = fields_keyOrder
else:
self.fields = OrderedDict((k,
Ah it works. After I restarted Django and hit F5 again it re-orders it now.
So the code above is the solution.
Thanks!
--
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
It still complained about the request, but I was finally able to get it to
work using this code:
def __init__(self, request, *args, **kwargs):
super(CustomContactForm, self).__init__(request=request, *args, **
kwargs)
fields_keyOrder = ['name', 'reason', 'email', 'body']
>
> So pass the request
>
def __init__(self, request, *args, **kwargs):
self.request=request
super(CustomContactForm, self).__init__(*args, **kwargs)
self.fields.keyOrder = ['name', 'reason', 'email', 'body']
--
You received this message because you are subscribed
Unfortunately this doesn't work as the contact form needs to be passed the
request as well. I tried to modify the call to super but it didn't work.
As a workaround what I did now was to look at the HTML Code that the tag {{
form.as_p }} creates, and copy and paste that into the HTML template
Try
def __init__(self, *args, **kwargs):
super(CustomContactForm, self).__init__(*args, **kwargs)
self.fields.keyOrder = ['name', 'reason', 'email', 'body']
On Tuesday, January 20, 2015 at 11:26:01 PM UTC+2, Tobias Dacoir wrote:
>
> I'm using django-contact-form which allows me
I'm using django-contact-form which allows me to subclass it and add custom
fields to it. However all my added fields will appear at the bottom. I even
tried overwriting the original fields but still the order they appear is
wrong. How can I control this? I tried searching for an answer, but
8 matches
Mail list logo