Finish dj-guardian setup

This commit is contained in:
Ludovic Stephan 2017-07-21 20:56:49 +02:00
parent e499281a1d
commit e2d5e726cd
3 changed files with 10 additions and 4 deletions

View file

@ -122,7 +122,7 @@ CHANNEL_LAYERS = {
}
}
AUTHENTICATION_BACKEND = (
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'guardian.backends.ObjectPermissionBackend',
)

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-20 13:37
# Generated by Django 1.11.3 on 2017-07-21 18:29
from __future__ import unicode_literals
from django.db import migrations, models
@ -11,6 +11,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('event', '0001_initial'),
('auth', '0008_alter_user_username_max_length'),
]
@ -19,7 +20,11 @@ class Migration(migrations.Migration):
name='GEGroup',
fields=[
('group_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='auth.Group')),
('event', models.ForeignKey(blank=True, help_text="Si spécifié, l'instance du modèle est spécifique à l'évènement en question", null=True, on_delete=django.db.models.deletion.CASCADE, to='event.Event', verbose_name='évènement')),
],
bases=('auth.group',),
options={
'abstract': False,
},
bases=('auth.group', models.Model),
),
]

View file

@ -1,9 +1,10 @@
from django.db import models
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from event.models import EventSpecificMixin
User = get_user_model()
class GEGroup(Group):
class GEGroup(EventSpecificMixin, Group):
pass