#27360: Make it easier to track down the offending models for AlreadyRegistered
exceptions
--------------------------------------+------------------------------------
Reporter: Ed Morley | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 1.8
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 Keryn Knight):
* cc: django@… (added)
Comment:
I'd think that providing the ModelAdmin label would be useful - the model
is always going to be the one you're trying to register the "current"
ModelAdmin for, so showing it's module or path is only going to be truly
useful with multiple models of the same name?
Perhaps something like:
{{{AlreadyRegistered: Cannot use myapp.admin.SecondModelAdmin for
myotherapp.MyModel, because myotherapp.admin.MyModelAdmin is already
registered}}}
Wording isn't perfect (for one thing, all of them say "AlreadyRegistered:
... already registered"), but you probably get the idea about surfacing as
much information as possible.
The previously registered ModelAdmin would have to be extracted from the
`_registry` to get it's label, but that ought to be simple enough.
I don't know whether shortening the model to {{{applabel.modelname}}} is
better or worse than including it's actual module -- models are routinely
referred to that way everywhere else, but given a ModelAdmin doesn't
really have an applabel, that would ''have'' to show the full class
name/module, so it might be inconsistent and confusing if the Model were
shortened.
--
Ticket URL: <https://code.djangoproject.com/ticket/27360#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/066.b18cb4bf1808aa351a0cf7b907a88f0b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.