mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
Prevent generation of useless migrations upon settings change
This commit is contained in:
20
club/migrations/0011_auto_20180426_2013.py
Normal file
20
club/migrations/0011_auto_20180426_2013.py
Normal file
@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import club.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('club', '0010_auto_20170912_2028'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='club',
|
||||
name='owner_group',
|
||||
field=models.ForeignKey(default=club.models.Club.get_default_owner_group, related_name='owned_club', to='core.Group'),
|
||||
),
|
||||
]
|
@ -62,9 +62,9 @@ class Club(models.Model):
|
||||
is_active = models.BooleanField(_('is active'), default=True)
|
||||
short_description = models.CharField(_('short description'), max_length=1000, default='', blank=True, null=True)
|
||||
address = models.CharField(_('address'), max_length=254)
|
||||
# email = models.EmailField(_('email address'), unique=True) # This should, and will be generated automatically
|
||||
owner_group = models.ForeignKey(Group, related_name="owned_club",
|
||||
default=settings.SITH_GROUP_ROOT_ID)
|
||||
# This function prevents generating migration upon settings change
|
||||
def get_default_owner_group(): return settings.SITH_GROUP_ROOT_ID
|
||||
owner_group = models.ForeignKey(Group, related_name="owned_club", default=get_default_owner_group)
|
||||
edit_groups = models.ManyToManyField(Group, related_name="editable_club", blank=True)
|
||||
view_groups = models.ManyToManyField(Group, related_name="viewable_club", blank=True)
|
||||
home = models.OneToOneField(SithFile, related_name='home_of_club', verbose_name=_("home"), null=True, blank=True,
|
||||
|
Reference in New Issue
Block a user