#30097: InlineModelAdmin.has_add_permission() requires obj argument
-------------------------------------+-------------------------------------
               Reporter:  Maxim      |          Owner:  nobody
  Zemskov                            |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.1
  contrib.admin                      |       Keywords:  contrib.admin,
               Severity:  Normal     |  admin, inline
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 InlineModelAdmin.has_add_permission() requires obj argument:
 {{{
 def has_add_permission(self, request, obj):
     if self.opts.auto_created:
         return self.has_view_permission(request, obj)
     return super().has_add_permission(request)
 }}}

 But implementation of InlineModelAdmin._has_add_permission() says obj will
 be required in django 3.0:

 {{{
 def _has_add_permission(self, request, obj):
     # RemovedInDjango30Warning: obj will be a required argument.
     args = get_func_args(self.has_add_permission)
     return self.has_add_permission(request, obj) if 'obj' in args else
 self.has_add_permission(request)
 }}}
 So, code will crush at **{{{self.has_add_permission(request)}}}** in
 return statement with {{{missing 1 required positional argument: 'obj'}}}.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30097>
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/055.08c13443418461a0e71413c890a143f2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to