Hi Carlton,

On Wed, 18 Mar 2020 17:11:49 +0100
Carlton Gibson <carlton.gib...@gmail.com> wrote:

> I triaged that, and was involved in the change in #29917 that led to
> your issue.
> 
> https://code.djangoproject.com/ticket/29917
> https://groups.google.com/d/topic/django-developers/-OWoYL_zryM/discussion
> 

Yes, I've seen these too.

> 
> I’ll have another review of it, but is there an **exact** change you
> have in mind that satisfies all the competing Wants? (It was all quite
> interconnected IIRC)
> 
I think they're not all that interconnected. The change in #29917 was
about duplication caused by inheritance; #30311 is about duplication
between an admin's specific actions and the site-wide actions. I fully
endorse and support the inheritance change.

The change I'd like to see is a rewrite of _get_base_actions(), so that
instead of blindly adding the site-wide actions, it only adds those not
defined by the specific admin. There's lines there[1] that say:

        for (name, func) in self.admin_site.actions:
            description = getattr(func, 'short_description', name.replace('_', 
' '))
            actions.append((func, name, description))

[1] 
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L855

and I'd like to see added something along the lines of:

        for (name, func) in self.admin_site.actions:
            if name in (self.actions or []): 
                continue   
            description = getattr(func, 'short_description', name.replace('_', 
' '))
            actions.append((func, name, description))

(that's too simplistic, actions can given by more than name, but
that's the general idea)

This way, if an admin wants to override, they just do.

HTH,
        Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20200318184443.2e47f79c.shai%40platonix.com.

Reply via email to