Opened 8 years ago

Closed 8 years ago

#6040 closed (invalid)

post_syncdb signal and contrib.auth permissions

Reported by: Dan <danielnaab@…> Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords: auth contrib.auth post_syncdb
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


This is a feature request for contrib.auth's

In an app's, doing:

from myapp import models
from django.contrib.auth.models import Permission

def init_data():
    perm = Permission.objects.get(codename=<permission string for models.my_model>)

dispatcher.connect(init_data, sender=models, signal=signals.post_syncdb)

where <permission string for models.my_model> is something like "change_mymodel", will trigger a DoesNotExist exception on first run of syncdb.

The problem is that contrib.auth is receiving the post_syncdb signal before "myapp", and there doesn't appear to be a way to force myapp to be the last receiver of the signal. Changing the order of the apps in has no effect.

A suggested solution would be to add a new signal fired by contrib.auth after creation of permissions. Or am I missing an obvious way to handle after contrib.auth?

Change History (1)

comment:1 Changed 8 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Questions about how best to use Django should be directed to the django-users mailing list.

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