Opened 18 years ago
Closed 18 years ago
#4587 closed (fixed)
[newforms-admin] attribute `model._meta.admin` is not assigned but it is needed in many places.
| Reported by: | yi.codeplayer at gmail dot com | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | newforms-admin |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
This patch is quiet simple, just set attribute model._meta.admin = admin_class before register the model.
PS: I've submit a ticket before, which fixed several bugs in newforms-admin branch including this one, but i don't see it fixed so far, so i decide to seperate this one out.
Attachments (1)
Change History (5)
by , 18 years ago
| Attachment: | model_meta_admin.patch added |
|---|
comment:1 by , 18 years ago
| Has patch: | set |
|---|---|
| Summary: | Fixed a bug: attribute `model._meta.admin` is not assigned but it is needed in many places. → newforms-admin: Fixed a bug: attribute `model._meta.admin` is not assigned but it is needed in many places. |
comment:2 by , 18 years ago
| Summary: | newforms-admin: Fixed a bug: attribute `model._meta.admin` is not assigned but it is needed in many places. → [newforms-admin] attribute `model._meta.admin` is not assigned but it is needed in many places. |
|---|---|
| Triage Stage: | Unreviewed → Ready for checkin |
comment:3 by , 18 years ago
| Patch needs improvement: | set |
|---|---|
| Triage Stage: | Ready for checkin → Accepted |
comment:4 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Ticket #5500 covers the last case where model._meta.admin is being used in the code. Please open new tickets if there are any more examples where _meta.admin is used in Django.
Note:
See TracTickets
for help on using tickets.
This is not going to work if you have multiple
AdminSiteinstances. The best way to fix this is to replace any calls tomodel._meta.adminwith code that looks something up from the currentAdminSite's registry. "current" only has meaning in view code, however.The
adminindexcommand in particular usesmodel._meta.adminand would really have no concept of what the "current"AdminSiteis (unless you always assumed it uses the default one.) We could give eachAdminSiteobject a unique name and letadminindextake that name as an optional argument (no argument means use the default one), or drop theadminindexcommand all together.