Thursday, August 9, 2012

ordering of post_syncdb signals?

Hi folks, I am a little confused with the ordering of the post_syncdb
signal? (using 1.2.4)

Looking at the code in auth and contenttype, what makes
auth.permission so sure that the appropriate content type was created
before the necessary permission is created?

Similarly, I have another app called 'payment', and inside my
management/__init__.py, i have the following:

from django.contrib.auth.models import Group, Permission
import payment.models as payModels

def init_permissions(sender, **kwargs):
""" initialization when appliation starts """
agents = Group.objects.get(name = "agents")
import pdb
pdb.set_trace()
if not
agents.permissions.filter(codename="can_buy_package").exists():
perm = Permission.objects.get(codename="can_buy_package")
agents.permissions.add(perm)

post_syncdb.connect(init_permissions, sender=payModels)

I couldn't get this to work because the permissions were not created
for my models at this stage. So, how is the ordering of the
post_syncdb executed?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate