Opened 3 years ago

Last modified 3 years ago

#33619 closed Uncategorized

Proxy model does not inherite indexes and constraints from base model — at Version 1

Reported by: Jaska Lee Owned by: nobody
Component: contrib.admin Version: 3.2
Severity: Normal Keywords: multiple model admin
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Jaska Lee)

Hi,

I am trying to enable multiple model admins for one model. Here is the scenario:

1) I have a model called A that has "abstract = true";
2) I have a model called B that inherits model A, which has all the fields, constraints, indexes, etc. under Meta;
3) I have a model admin for model B and everything works as expected.
4) Now, I want to create another model admin for model B. The solution is to utilize a proxy model C to B as suggested at the following link,
https://stackoverflow.com/questions/2223375/multiple-modeladmins-views-for-same-model-in-django-admin

The problem is that the proxy model C does not inherit constraints, indexes from model B. And my app has some extra logic to check index and constraint definition, the absence of which caused some problems apparently.

Is it intended behavior of proxy model? If it is, is there any other way to create multiple admins for one model?

Thanks very much,
Jaska

Change History (1)

comment:1 by Jaska Lee, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top