mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 02:24:26 +00:00
Small club fix
This commit is contained in:
parent
e4070c86fd
commit
3302fdc6f2
@ -3,6 +3,7 @@ from django.core import validators
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import IntegrityError
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from core.models import User, MetaGroup, Group
|
from core.models import User, MetaGroup, Group
|
||||||
@ -50,8 +51,12 @@ class Club(models.Model):
|
|||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
super(Club, self).save()
|
super(Club, self).save()
|
||||||
|
try:
|
||||||
MetaGroup(name=self.unix_name+settings.SITH_BOARD_SUFFIX).save()
|
MetaGroup(name=self.unix_name+settings.SITH_BOARD_SUFFIX).save()
|
||||||
MetaGroup(name=self.unix_name+settings.SITH_MEMBER_SUFFIX).save()
|
MetaGroup(name=self.unix_name+settings.SITH_MEMBER_SUFFIX).save()
|
||||||
|
except IntegrityError as e:
|
||||||
|
# Groups already exists
|
||||||
|
pass
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -94,6 +94,6 @@ class ClubEditPropView(CanEditPropMixin, UpdateView):
|
|||||||
"""
|
"""
|
||||||
model = Club
|
model = Club
|
||||||
pk_url_kwarg = "club_id"
|
pk_url_kwarg = "club_id"
|
||||||
fields = ['name', 'parent']
|
fields = ['name', 'unix_name', 'parent']
|
||||||
template_name = 'club/club_edit_prop.jinja'
|
template_name = 'club/club_edit_prop.jinja'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user