#8394: ModelForm subclasses act differently to ModelForms even if no changes are
made
---------------------------------+------------------------------------------
Reporter: devinj | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------+------------------------------------------
Changes (by jarrow):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Up front: My comment does only speak about the admin. I haven't tested the
issue outside of it ...
This looks like the issue described here #8299. Try adding the Meta: model
= MyModel part to you ModelForm subclass. If it still breaks a ''minimal''
example would be really helpful.
I actually looked at this some more after filing #8299. I think the only
thing that breaks ''if you don't add a Meta class'' to your ModelForm
subclass is the '''validation''' of the fieldsets attribute you provide
(and maybe for other attributes). '''The actual admin works! ''' When
DEBUG is True it is checked that the fields you provide in the fieldsets
do exist in the form. But this is not the actual form that is used in the
admin. As far as I know the admin always uses get_form() which adds all
necessary information to the subclass.
So I tried fixing the validation but that would pretty much require to
move the stuff that's hapening in the implementation of get_form() to some
static function and calling that in the validation code. I though this
might be to great a change but still it would be possible to fix this (in
the admin at least). See validation code at:
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/validation.py#L275
--
Ticket URL: <http://code.djangoproject.com/ticket/8394#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---