#14496: Conflict between ModelForm.Meta.exclude and ModelAdmin.readonly 
attributes
-------------------------------------+-------------------------------------
     Reporter:  msgre_valise         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  contrib.admin        |                  Version:  1.2
     Severity:  Normal               |               Resolution:  fixed
     Keywords:  ModelForm            |             Triage Stage:  Ready for
  ModelAdmin readonly_fields         |  checkin
  exclude conflict                   |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by anonymous):

 In case someone wants code to work around this, put this in your
 ModelAdmin subclass:

 {{{
     def get_form(self, request, obj=None, **kwargs):
         """Work around https://code.djangoproject.com/ticket/14496 (not
 fixed in Django 1.3)"""
         form = super(OffcutAdminRestricted, self).get_form(request, obj,
 **kwargs)
         for e in self.form._meta.exclude:
             if e in form.base_fields:
                 del form.base_fields[e]
                 form._meta.exclude.append(e)
         return form
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/14496#comment:9>
Django <https://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.

Reply via email to