Hi,
I have problem with Django Forms and field with set attrs to
disabled="disabled"
# forms.py
class EditForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(EditForm, self).__init__(*args, **kwargs)
self.fields['title'].widget.attrs.update({'readonly':
'readonly', 'disabled': 'disabled'})
class Meta:
model = MyModel
fields = ('title', 'tagline')
# views.py
form = EditForm(request.POST, instance=my_instance)
if form.is_valid():
form.save()
# models.py
class MyModel(models.Model):
title = models.CharField(max_length=120, db_index=True)
tagline = models.TextField(, max_length=500, db_index=True)
And now, Django remove values form field with attrs 'disabled':
'disabled' ("readonly" without "disabled" works fine, but I need
disabled option in my html output). Why Django do that?
Thanks for help.
regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---