2221b23447
Removed the config cache and created files for each app in which the config variables are defined.
23 lines
864 B
Python
23 lines
864 B
Python
from django.contrib.auth.models import Permission
|
|
from django.contrib.contenttypes.models import ContentType
|
|
from django.db.models import Q
|
|
from django.dispatch import Signal
|
|
|
|
# This signal is sent when the migrate command is done. That means it is sent
|
|
# after post_migrate sending and creating all Permission objects. Don't use it
|
|
# for other things than dealing with Permission objects.
|
|
post_permission_creation = Signal()
|
|
|
|
|
|
def delete_django_app_permissions(sender, **kwargs):
|
|
"""
|
|
Deletes the permissions, Django creates by default. Only required
|
|
for auth, contenttypes and sessions.
|
|
"""
|
|
contenttypes = ContentType.objects.filter(
|
|
Q(app_label='auth') |
|
|
Q(app_label='contenttypes') |
|
|
Q(app_label='sessions'))
|
|
for permission in Permission.objects.filter(content_type__in=contenttypes):
|
|
permission.delete()
|