Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1856 closed defect (fixed)

[patch] content types and permissions not populated unless model contains inner Admin class

Reported by: mattimustang@… Owned by: adrian
Component: contrib.admin Version: master
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I've discovered that if your model doesn't have and inner Admin class defined then unless you call ContentType.objects.get_for_model() somewhere in your own code, the content type for that model is never created.

Same goes for permissions. django/contrib/auth/ doesn't create perms unless the model has Admin defined.

I found this out when I finally got around to implementing my own views for add/change/delete of a model and when I removed the inner Admin class because I no longer needed it, my views broke after a fresh install because neither perms or content types were being set up.

The following patch fixes this.


Mathew Flanagan

Attachments (1)

djangocontenttypeandperms.diff (1.6 KB) - added by mattimustang@… 9 years ago.
content types and perms creation patch

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by mattimustang@…

content types and perms creation patch

comment:1 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [3148]) Fixed #1856 -- install content-type entries and auth permissions for
models regardless of the presence of an inner Admin class. Patch from Mathew

Note: See TracTickets for help on using tickets.
Back to Top