Django

Code

Ticket #1856 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

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

Reported by: mattimustang@gmail.com Assigned to: adrian
Milestone: Component: django.contrib.admin
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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/management.py 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.

regards

Mathew Flanagan

Attachments

djangocontenttypeandperms.diff (1.6 kB) - added by mattimustang@gmail.com on 05/14/06 09:27:28.
content types and perms creation patch

Change History

05/14/06 09:27:28 changed by mattimustang@gmail.com

  • attachment djangocontenttypeandperms.diff added.

content types and perms creation patch

06/19/06 07:50:57 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(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 Flanagan.


Add/Change #1856 ([patch] content types and permissions not populated unless model contains inner Admin class)




Change Properties
Action