I am using custom permissions in my Django models like this:
class T21Turma(models.Model):
class Meta:
permissions = (("can_view_boletim", "Can view boletim"),
("can_view_mensalidades", "Can view mensalidades"),)
The problem is that when I add a permission to the list it doesn't get added to the auth_permission
table when I run syncdb. What am I doing wrong. If it makes any difference I am using south for database migrations.
You can connect to the
post_migrate
signal in order to update the permissions after migration. I use the following code, slightly modified from Dev with Passion and originally from django-extensions.This worked for me:
It is a django-extensions thing.
South does not track django.contrib.auth permissions. See ticket #211 for more information.
One of the comments on the ticket suggests that using the
--all
option on syncdb may solve the problem.When i runnning migration with following code
I getting folloving error
To prevent this error, i modified the code
If you want "manage.py migrate" to do everything (without calling syncdb --all). You need to create new permissions with a migration:
Edit the created file: