#27157: AdminForm may crash if model_admin argument is None
-------------------------------+------------------------------------
     Reporter:  tpazderka      |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  contrib.admin  |                  Version:  1.10
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------
Changes (by timgraham):

 * stage:  Unreviewed => Accepted


Comment:

 I guess, for example, we need to account for `model_admin=None` in a place
 like
 
[https://github.com/django/django/blob/d8ef5b0e6501692b8b767ebccddc936f496d77e8/django/contrib/admin/helpers.py#L185
 AdminReadonlyField]. It's not so clear to me why `model_admin` is an
 optional argument (see bcd9482a2019158f4580c24cd50ee8bfae9b2739), perhaps
 for backwards compatibility. A better resolution might be a deprecation
 path toward making those arguments required unless there's argument
 against it. In your case, if you using that formset for the admin, then a
 possibility would be to declare the formset in
 `ModelAdmin.get_changelist_formset()` so you can access to the
 `ModelAdmin` class (`self`).

--
Ticket URL: <https://code.djangoproject.com/ticket/27157#comment:3>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.84af99be86bcebfb4df8b45d9e88d2b9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to