#36498: Inline button to add first / only related instance should say "Add ...",
not "Add another ..."
-------------------------------------+-------------------------------------
     Reporter:  Denis Washington     |                    Owner:  Dorian
         Type:                       |  Adams
  Cleanup/optimization               |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  5.2
     Severity:  Normal               |               Resolution:
     Keywords:  inline               |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  1
-------------------------------------+-------------------------------------
Comment (by Dorian Adams):

 Replying to [comment:5 Antoliny]:

 Thanks for the additional info. It looks like a DB query may be necessary,
 but only when the user has add permission and lacks change permission.
 From what I can gather, this is due to the permission-based filtering
 applied to `formset.get_queryset()` within the `__iter__` method of
 `InlineAdminFormSet`.

 From `InlineModelAdmin`:

 {{{
     def get_queryset(self, request):
         queryset = super().get_queryset(request)
         if not self.has_view_or_change_permission(request):
             queryset = queryset.none()
         return queryset
 }}}

 I opened a PR with a potential workaround that relies on what's available
 in the database across all scenarios. The query only runs when necessary.
 However, the potential downside is that this would reveal the existence of
 records to users without view permission.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36498#comment:7>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070198351ed60b-db86f90c-b20b-4352-9c12-1006c0bd5646-000000%40eu-central-1.amazonses.com.

Reply via email to