Specify the on_delete attribute everywhere
- Models - Migrations
This commit is contained in:
parent
859f191894
commit
9f401b66e9
14 changed files with 299 additions and 93 deletions
|
@ -59,7 +59,9 @@ class Migration(migrations.Migration):
|
||||||
('price', models.FloatField(verbose_name=b"Prix d'une place", blank=True)),
|
('price', models.FloatField(verbose_name=b"Prix d'une place", blank=True)),
|
||||||
('slots', models.IntegerField(verbose_name=b'Places')),
|
('slots', models.IntegerField(verbose_name=b'Places')),
|
||||||
('priority', models.IntegerField(default=1000, verbose_name=b'Priorit\xc3\xa9')),
|
('priority', models.IntegerField(default=1000, verbose_name=b'Priorit\xc3\xa9')),
|
||||||
('location', models.ForeignKey(to='bda.Salle')),
|
('location', models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Salle')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('priority', 'date', 'title'),
|
'ordering': ('priority', 'date', 'title'),
|
||||||
|
@ -79,27 +81,39 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='participant',
|
model_name='participant',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.OneToOneField(to=settings.AUTH_USER_MODEL),
|
field=models.OneToOneField(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='choixspectacle',
|
model_name='choixspectacle',
|
||||||
name='participant',
|
name='participant',
|
||||||
field=models.ForeignKey(to='bda.Participant'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Participant'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='choixspectacle',
|
model_name='choixspectacle',
|
||||||
name='spectacle',
|
name='spectacle',
|
||||||
field=models.ForeignKey(related_name='participants', to='bda.Spectacle'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='participants',
|
||||||
|
to='bda.Spectacle'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='attribution',
|
model_name='attribution',
|
||||||
name='participant',
|
name='participant',
|
||||||
field=models.ForeignKey(to='bda.Participant'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Participant'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='attribution',
|
model_name='attribution',
|
||||||
name='spectacle',
|
name='spectacle',
|
||||||
field=models.ForeignKey(related_name='attribues', to='bda.Spectacle'),
|
field=models.ForeignKey(
|
||||||
|
related_name='attribues',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Spectacle'),
|
||||||
),
|
),
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
name='choixspectacle',
|
name='choixspectacle',
|
||||||
|
|
|
@ -39,18 +39,26 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='participant',
|
model_name='participant',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='participant',
|
model_name='participant',
|
||||||
name='tirage',
|
name='tirage',
|
||||||
field=models.ForeignKey(default=1, to='bda.Tirage'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
default=1,
|
||||||
|
to='bda.Tirage'),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='spectacle',
|
model_name='spectacle',
|
||||||
name='tirage',
|
name='tirage',
|
||||||
field=models.ForeignKey(default=1, to='bda.Tirage'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
default=1,
|
||||||
|
to='bda.Tirage'),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -72,7 +72,10 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='spectacle',
|
model_name='spectacle',
|
||||||
name='category',
|
name='category',
|
||||||
field=models.ForeignKey(blank=True, to='bda.CategorieSpectacle',
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
blank=True,
|
||||||
|
to='bda.CategorieSpectacle',
|
||||||
null=True),
|
null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
|
@ -84,6 +87,8 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='quote',
|
model_name='quote',
|
||||||
name='spectacle',
|
name='spectacle',
|
||||||
field=models.ForeignKey(to='bda.Spectacle'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Spectacle'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -46,21 +46,28 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='spectaclerevente',
|
model_name='spectaclerevente',
|
||||||
name='attribution',
|
name='attribution',
|
||||||
field=models.OneToOneField(to='bda.Attribution',
|
field=models.OneToOneField(
|
||||||
|
to='bda.Attribution',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
related_name='revente'),
|
related_name='revente'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='spectaclerevente',
|
model_name='spectaclerevente',
|
||||||
name='seller',
|
name='seller',
|
||||||
field=models.ForeignKey(to='bda.Participant',
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Participant',
|
||||||
verbose_name='Vendeur',
|
verbose_name='Vendeur',
|
||||||
related_name='original_shows'),
|
related_name='original_shows'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='spectaclerevente',
|
model_name='spectaclerevente',
|
||||||
name='soldTo',
|
name='soldTo',
|
||||||
field=models.ForeignKey(to='bda.Participant',
|
field=models.ForeignKey(
|
||||||
verbose_name='Vendue à', null=True,
|
on_delete=models.CASCADE,
|
||||||
|
to='bda.Participant',
|
||||||
|
verbose_name='Vendue à',
|
||||||
|
null=True,
|
||||||
blank=True),
|
blank=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -46,9 +46,14 @@ class CategorieSpectacle(models.Model):
|
||||||
|
|
||||||
class Spectacle(models.Model):
|
class Spectacle(models.Model):
|
||||||
title = models.CharField("Titre", max_length=300)
|
title = models.CharField("Titre", max_length=300)
|
||||||
category = models.ForeignKey(CategorieSpectacle, blank=True, null=True)
|
category = models.ForeignKey(
|
||||||
|
CategorieSpectacle,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
blank=True,
|
||||||
|
null=True
|
||||||
|
)
|
||||||
date = models.DateTimeField("Date & heure")
|
date = models.DateTimeField("Date & heure")
|
||||||
location = models.ForeignKey(Salle)
|
location = models.ForeignKey(Salle, on_delete=models.CASCADE)
|
||||||
vips = models.TextField('Personnalités', blank=True)
|
vips = models.TextField('Personnalités', blank=True)
|
||||||
description = models.TextField("Description", blank=True)
|
description = models.TextField("Description", blank=True)
|
||||||
slots_description = models.TextField("Description des places", blank=True)
|
slots_description = models.TextField("Description des places", blank=True)
|
||||||
|
@ -58,7 +63,7 @@ class Spectacle(models.Model):
|
||||||
max_length=500)
|
max_length=500)
|
||||||
price = models.FloatField("Prix d'une place")
|
price = models.FloatField("Prix d'une place")
|
||||||
slots = models.IntegerField("Places")
|
slots = models.IntegerField("Places")
|
||||||
tirage = models.ForeignKey(Tirage)
|
tirage = models.ForeignKey(Tirage, on_delete=models.CASCADE)
|
||||||
listing = models.BooleanField("Les places sont sur listing")
|
listing = models.BooleanField("Les places sont sur listing")
|
||||||
rappel_sent = models.DateTimeField("Mail de rappel envoyé", blank=True,
|
rappel_sent = models.DateTimeField("Mail de rappel envoyé", blank=True,
|
||||||
null=True)
|
null=True)
|
||||||
|
@ -116,7 +121,7 @@ class Spectacle(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class Quote(models.Model):
|
class Quote(models.Model):
|
||||||
spectacle = models.ForeignKey(Spectacle)
|
spectacle = models.ForeignKey(Spectacle, on_delete=models.CASCADE)
|
||||||
text = models.TextField('Citation')
|
text = models.TextField('Citation')
|
||||||
author = models.CharField('Auteur', max_length=200)
|
author = models.CharField('Auteur', max_length=200)
|
||||||
|
|
||||||
|
@ -130,7 +135,7 @@ PAYMENT_TYPES = (
|
||||||
|
|
||||||
|
|
||||||
class Participant(models.Model):
|
class Participant(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
choices = models.ManyToManyField(Spectacle,
|
choices = models.ManyToManyField(Spectacle,
|
||||||
through="ChoixSpectacle",
|
through="ChoixSpectacle",
|
||||||
related_name="chosen_by")
|
related_name="chosen_by")
|
||||||
|
@ -141,7 +146,7 @@ class Participant(models.Model):
|
||||||
paymenttype = models.CharField("Moyen de paiement",
|
paymenttype = models.CharField("Moyen de paiement",
|
||||||
max_length=6, choices=PAYMENT_TYPES,
|
max_length=6, choices=PAYMENT_TYPES,
|
||||||
blank=True)
|
blank=True)
|
||||||
tirage = models.ForeignKey(Tirage)
|
tirage = models.ForeignKey(Tirage, on_delete=models.CASCADE)
|
||||||
choicesrevente = models.ManyToManyField(Spectacle,
|
choicesrevente = models.ManyToManyField(Spectacle,
|
||||||
related_name="subscribed",
|
related_name="subscribed",
|
||||||
blank=True)
|
blank=True)
|
||||||
|
@ -157,8 +162,15 @@ DOUBLE_CHOICES = (
|
||||||
|
|
||||||
|
|
||||||
class ChoixSpectacle(models.Model):
|
class ChoixSpectacle(models.Model):
|
||||||
participant = models.ForeignKey(Participant)
|
participant = models.ForeignKey(
|
||||||
spectacle = models.ForeignKey(Spectacle, related_name="participants")
|
Participant,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
spectacle = models.ForeignKey(
|
||||||
|
Spectacle,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="participants"
|
||||||
|
)
|
||||||
priority = models.PositiveIntegerField("Priorité")
|
priority = models.PositiveIntegerField("Priorité")
|
||||||
double_choice = models.CharField("Nombre de places",
|
double_choice = models.CharField("Nombre de places",
|
||||||
default="1", choices=DOUBLE_CHOICES,
|
default="1", choices=DOUBLE_CHOICES,
|
||||||
|
@ -185,8 +197,15 @@ class ChoixSpectacle(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class Attribution(models.Model):
|
class Attribution(models.Model):
|
||||||
participant = models.ForeignKey(Participant)
|
participant = models.ForeignKey(
|
||||||
spectacle = models.ForeignKey(Spectacle, related_name="attribues")
|
Participant,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
spectacle = models.ForeignKey(
|
||||||
|
Spectacle,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="attribues"
|
||||||
|
)
|
||||||
given = models.BooleanField("Donnée", default=False)
|
given = models.BooleanField("Donnée", default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -195,19 +214,29 @@ class Attribution(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class SpectacleRevente(models.Model):
|
class SpectacleRevente(models.Model):
|
||||||
attribution = models.OneToOneField(Attribution,
|
attribution = models.OneToOneField(
|
||||||
related_name="revente")
|
Attribution,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="revente"
|
||||||
|
)
|
||||||
date = models.DateTimeField("Date de mise en vente",
|
date = models.DateTimeField("Date de mise en vente",
|
||||||
default=timezone.now)
|
default=timezone.now)
|
||||||
answered_mail = models.ManyToManyField(Participant,
|
answered_mail = models.ManyToManyField(Participant,
|
||||||
related_name="wanted",
|
related_name="wanted",
|
||||||
blank=True)
|
blank=True)
|
||||||
seller = models.ForeignKey(Participant,
|
seller = models.ForeignKey(
|
||||||
|
Participant,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
related_name="original_shows",
|
related_name="original_shows",
|
||||||
verbose_name="Vendeur")
|
verbose_name="Vendeur"
|
||||||
soldTo = models.ForeignKey(Participant, blank=True, null=True,
|
)
|
||||||
verbose_name="Vendue à")
|
soldTo = models.ForeignKey(
|
||||||
|
Participant,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
verbose_name="Vendue à"
|
||||||
|
)
|
||||||
notif_sent = models.BooleanField("Notification envoyée",
|
notif_sent = models.BooleanField("Notification envoyée",
|
||||||
default=False)
|
default=False)
|
||||||
tirage_done = models.BooleanField("Tirage effectué",
|
tirage_done = models.BooleanField("Tirage effectué",
|
||||||
|
|
|
@ -23,7 +23,10 @@ class Migration(migrations.Migration):
|
||||||
('cotisation_period', models.CharField(choices=[('ANN', 'Année'), ('SE1', 'Premier semestre'), ('SE2', 'Deuxième semestre')], verbose_name='Inscription', max_length=3, default='ANN')),
|
('cotisation_period', models.CharField(choices=[('ANN', 'Année'), ('SE1', 'Premier semestre'), ('SE2', 'Deuxième semestre')], verbose_name='Inscription', max_length=3, default='ANN')),
|
||||||
('registration_date', models.DateField(verbose_name="Date d'inscription", auto_now_add=True)),
|
('registration_date', models.DateField(verbose_name="Date d'inscription", auto_now_add=True)),
|
||||||
('payment_method', models.CharField(choices=[('CASH', 'Liquide'), ('BANK', 'Transfer bancaire'), ('CHEQUE', 'Cheque'), ('OTHER', 'Autre')], verbose_name='Methode de paiement', max_length=6, default='CASH')),
|
('payment_method', models.CharField(choices=[('CASH', 'Liquide'), ('BANK', 'Transfer bancaire'), ('CHEQUE', 'Cheque'), ('OTHER', 'Autre')], verbose_name='Methode de paiement', max_length=6, default='CASH')),
|
||||||
('profile', models.OneToOneField(related_name='bds', to='gestion.Profile')),
|
('profile', models.OneToOneField(
|
||||||
|
related_name='bds',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='gestion.Profile')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -48,7 +48,10 @@ class Migration(migrations.Migration):
|
||||||
('is_buro', models.BooleanField(default=False, verbose_name=b'Membre du Bur\xc3\xb4')),
|
('is_buro', models.BooleanField(default=False, verbose_name=b'Membre du Bur\xc3\xb4')),
|
||||||
('petits_cours_accept', models.BooleanField(default=False, verbose_name=b'Recevoir des petits cours')),
|
('petits_cours_accept', models.BooleanField(default=False, verbose_name=b'Recevoir des petits cours')),
|
||||||
('petits_cours_remarques', models.TextField(default=b'', verbose_name='Remarques et pr\xe9cisions pour les petits cours', blank=True)),
|
('petits_cours_remarques', models.TextField(default=b'', verbose_name='Remarques et pr\xe9cisions pour les petits cours', blank=True)),
|
||||||
('user', models.OneToOneField(related_name='profile', to=settings.AUTH_USER_MODEL)),
|
('user', models.OneToOneField(
|
||||||
|
related_name='profile',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Profil COF',
|
'verbose_name': 'Profil COF',
|
||||||
|
@ -91,7 +94,10 @@ class Migration(migrations.Migration):
|
||||||
('name', models.CharField(max_length=200, verbose_name=b'Champ')),
|
('name', models.CharField(max_length=200, verbose_name=b'Champ')),
|
||||||
('fieldtype', models.CharField(default=b'text', max_length=10, verbose_name=b'Type', choices=[(b'text', 'Texte long'), (b'char', 'Texte court')])),
|
('fieldtype', models.CharField(default=b'text', max_length=10, verbose_name=b'Type', choices=[(b'text', 'Texte long'), (b'char', 'Texte court')])),
|
||||||
('default', models.TextField(verbose_name=b'Valeur par d\xc3\xa9faut', blank=True)),
|
('default', models.TextField(verbose_name=b'Valeur par d\xc3\xa9faut', blank=True)),
|
||||||
('event', models.ForeignKey(related_name='commentfields', to='cof.Event')),
|
('event', models.ForeignKey(
|
||||||
|
related_name='commentfields',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.Event')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Champ',
|
'verbose_name': 'Champ',
|
||||||
|
@ -102,7 +108,10 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('content', models.TextField(null=True, verbose_name=b'Contenu', blank=True)),
|
('content', models.TextField(null=True, verbose_name=b'Contenu', blank=True)),
|
||||||
('commentfield', models.ForeignKey(related_name='values', to='cof.EventCommentField')),
|
('commentfield', models.ForeignKey(
|
||||||
|
related_name='values',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.EventCommentField')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
|
@ -111,7 +120,10 @@ class Migration(migrations.Migration):
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('name', models.CharField(max_length=200, verbose_name=b'Option')),
|
('name', models.CharField(max_length=200, verbose_name=b'Option')),
|
||||||
('multi_choices', models.BooleanField(default=False, verbose_name=b'Choix multiples')),
|
('multi_choices', models.BooleanField(default=False, verbose_name=b'Choix multiples')),
|
||||||
('event', models.ForeignKey(related_name='options', to='cof.Event')),
|
('event', models.ForeignKey(
|
||||||
|
related_name='options',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.Event')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Option',
|
'verbose_name': 'Option',
|
||||||
|
@ -122,7 +134,10 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('value', models.CharField(max_length=200, verbose_name=b'Valeur')),
|
('value', models.CharField(max_length=200, verbose_name=b'Valeur')),
|
||||||
('event_option', models.ForeignKey(related_name='choices', to='cof.EventOption')),
|
('event_option', models.ForeignKey(
|
||||||
|
related_name='choices',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.EventOption')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Choix',
|
'verbose_name': 'Choix',
|
||||||
|
@ -133,10 +148,14 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('paid', models.BooleanField(default=False, verbose_name=b'A pay\xc3\xa9')),
|
('paid', models.BooleanField(default=False, verbose_name=b'A pay\xc3\xa9')),
|
||||||
('event', models.ForeignKey(to='cof.Event')),
|
('event', models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.Event')),
|
||||||
('filledcomments', models.ManyToManyField(to='cof.EventCommentField', through='cof.EventCommentValue')),
|
('filledcomments', models.ManyToManyField(to='cof.EventCommentField', through='cof.EventCommentValue')),
|
||||||
('options', models.ManyToManyField(to='cof.EventOptionChoice')),
|
('options', models.ManyToManyField(to='cof.EventOptionChoice')),
|
||||||
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
|
('user', models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Inscription',
|
'verbose_name': 'Inscription',
|
||||||
|
@ -240,7 +259,10 @@ class Migration(migrations.Migration):
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('question', models.CharField(max_length=200, verbose_name=b'Question')),
|
('question', models.CharField(max_length=200, verbose_name=b'Question')),
|
||||||
('multi_answers', models.BooleanField(default=False, verbose_name=b'Choix multiples')),
|
('multi_answers', models.BooleanField(default=False, verbose_name=b'Choix multiples')),
|
||||||
('survey', models.ForeignKey(related_name='questions', to='cof.Survey')),
|
('survey', models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='questions',
|
||||||
|
to='cof.Survey')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Question',
|
'verbose_name': 'Question',
|
||||||
|
@ -251,7 +273,10 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('answer', models.CharField(max_length=200, verbose_name=b'R\xc3\xa9ponse')),
|
('answer', models.CharField(max_length=200, verbose_name=b'R\xc3\xa9ponse')),
|
||||||
('survey_question', models.ForeignKey(related_name='answers', to='cof.SurveyQuestion')),
|
('survey_question', models.ForeignKey(
|
||||||
|
related_name='answers',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.SurveyQuestion')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'R\xe9ponse',
|
'verbose_name': 'R\xe9ponse',
|
||||||
|
@ -265,12 +290,16 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='surveyanswer',
|
model_name='surveyanswer',
|
||||||
name='survey',
|
name='survey',
|
||||||
field=models.ForeignKey(to='cof.Survey'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to='cof.Survey'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='surveyanswer',
|
model_name='surveyanswer',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursdemande',
|
model_name='petitcoursdemande',
|
||||||
|
@ -280,47 +309,72 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursdemande',
|
model_name='petitcoursdemande',
|
||||||
name='traitee_par',
|
name='traitee_par',
|
||||||
field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
blank=True,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursattributioncounter',
|
model_name='petitcoursattributioncounter',
|
||||||
name='matiere',
|
name='matiere',
|
||||||
field=models.ForeignKey(verbose_name='Matiere', to='cof.PetitCoursSubject'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name='Matiere',
|
||||||
|
to='cof.PetitCoursSubject'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursattributioncounter',
|
model_name='petitcoursattributioncounter',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursattribution',
|
model_name='petitcoursattribution',
|
||||||
name='demande',
|
name='demande',
|
||||||
field=models.ForeignKey(verbose_name='Demande', to='cof.PetitCoursDemande'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name='Demande',
|
||||||
|
to='cof.PetitCoursDemande'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursattribution',
|
model_name='petitcoursattribution',
|
||||||
name='matiere',
|
name='matiere',
|
||||||
field=models.ForeignKey(verbose_name='Mati\xe8re', to='cof.PetitCoursSubject'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name='Mati\xe8re',
|
||||||
|
to='cof.PetitCoursSubject'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursattribution',
|
model_name='petitcoursattribution',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursability',
|
model_name='petitcoursability',
|
||||||
name='matiere',
|
name='matiere',
|
||||||
field=models.ForeignKey(verbose_name='Mati\xe8re', to='cof.PetitCoursSubject'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name='Mati\xe8re',
|
||||||
|
to='cof.PetitCoursSubject'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='petitcoursability',
|
model_name='petitcoursability',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='eventcommentvalue',
|
model_name='eventcommentvalue',
|
||||||
name='registration',
|
name='registration',
|
||||||
field=models.ForeignKey(related_name='comments', to='cof.EventRegistration'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='comments',
|
||||||
|
to='cof.EventRegistration'),
|
||||||
),
|
),
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
name='surveyanswer',
|
name='surveyanswer',
|
||||||
|
|
|
@ -23,7 +23,9 @@ class Migration(migrations.Migration):
|
||||||
('subscribe_to_events', models.BooleanField(default=True)),
|
('subscribe_to_events', models.BooleanField(default=True)),
|
||||||
('subscribe_to_my_shows', models.BooleanField(default=True)),
|
('subscribe_to_my_shows', models.BooleanField(default=True)),
|
||||||
('other_shows', models.ManyToManyField(to='bda.Spectacle')),
|
('other_shows', models.ManyToManyField(to='bda.Spectacle')),
|
||||||
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
|
('user', models.OneToOneField(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.AlterModelOptions(
|
migrations.AlterModelOptions(
|
||||||
|
|
|
@ -23,23 +23,23 @@ def create_profile(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
def preserve_perms(apps, schema_editor):
|
def preserve_perms(apps, schema_editor):
|
||||||
from django.contrib.auth.management import create_permissions
|
# from django.contrib.auth.management import create_permissions
|
||||||
|
|
||||||
apps.models_module = True
|
# apps.models_module = True
|
||||||
create_permissions(apps, verbosity=0)
|
# create_permissions(apps, verbosity=0)
|
||||||
apps.models_module = None
|
# apps.models_module = None
|
||||||
|
|
||||||
CofProfile = apps.get_model("cof", "CofProfile")
|
CofProfile = apps.get_model("cof", "CofProfile")
|
||||||
memberp = Permission.objects.get(codename='member')
|
# memberp = Permission.objects.get(codename='member')
|
||||||
burop = Permission.objects.get(codename='buro')
|
# burop = Permission.objects.get(codename='buro')
|
||||||
|
|
||||||
# creates the groups for COF members and
|
# creates the groups for COF members and
|
||||||
member = Group.objects.create(name='cof_members')
|
member = Group.objects.create(name='cof_members')
|
||||||
buro = Group.objects.create(name='cof_buro')
|
buro = Group.objects.create(name='cof_buro')
|
||||||
|
|
||||||
# associate permissions to the respective groups.
|
# associate permissions to the respective groups.
|
||||||
buro.permissions = [burop, memberp]
|
# buro.permissions = [burop, memberp]
|
||||||
member.permissions = [memberp]
|
# member.permissions = [memberp]
|
||||||
|
|
||||||
for cofp in CofProfile.objects.filter(is_cof=True):
|
for cofp in CofProfile.objects.filter(is_cof=True):
|
||||||
cofp.profile.user.groups.add(member)
|
cofp.profile.user.groups.add(member)
|
||||||
|
@ -70,6 +70,7 @@ class Migration(migrations.Migration):
|
||||||
model_name='cofprofile',
|
model_name='cofprofile',
|
||||||
name='profile',
|
name='profile',
|
||||||
field=models.OneToOneField(
|
field=models.OneToOneField(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
to='gestion.Profile',
|
to='gestion.Profile',
|
||||||
null=True,
|
null=True,
|
||||||
related_name='cof'
|
related_name='cof'
|
||||||
|
@ -89,6 +90,7 @@ class Migration(migrations.Migration):
|
||||||
model_name='cofprofile',
|
model_name='cofprofile',
|
||||||
name='profile',
|
name='profile',
|
||||||
field=models.OneToOneField(
|
field=models.OneToOneField(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
to='gestion.Profile',
|
to='gestion.Profile',
|
||||||
related_name='cof'
|
related_name='cof'
|
||||||
),
|
),
|
||||||
|
|
|
@ -113,7 +113,11 @@ class Event(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class EventCommentField(models.Model):
|
class EventCommentField(models.Model):
|
||||||
event = models.ForeignKey(Event, related_name="commentfields")
|
event = models.ForeignKey(
|
||||||
|
Event,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="commentfields"
|
||||||
|
)
|
||||||
name = models.CharField("Champ", max_length=200)
|
name = models.CharField("Champ", max_length=200)
|
||||||
fieldtype = models.CharField("Type", max_length=10,
|
fieldtype = models.CharField("Type", max_length=10,
|
||||||
choices=TYPE_COMMENT_FIELD, default="text")
|
choices=TYPE_COMMENT_FIELD, default="text")
|
||||||
|
@ -128,9 +132,16 @@ class EventCommentField(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class EventCommentValue(models.Model):
|
class EventCommentValue(models.Model):
|
||||||
commentfield = models.ForeignKey(EventCommentField, related_name="values")
|
commentfield = models.ForeignKey(
|
||||||
registration = models.ForeignKey("EventRegistration",
|
EventCommentField,
|
||||||
related_name="comments")
|
on_delete=models.CASCADE,
|
||||||
|
related_name="values"
|
||||||
|
)
|
||||||
|
registration = models.ForeignKey(
|
||||||
|
"EventRegistration",
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="comments"
|
||||||
|
)
|
||||||
content = models.TextField("Contenu", blank=True, null=True)
|
content = models.TextField("Contenu", blank=True, null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -139,7 +150,11 @@ class EventCommentValue(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class EventOption(models.Model):
|
class EventOption(models.Model):
|
||||||
event = models.ForeignKey(Event, related_name="options")
|
event = models.ForeignKey(
|
||||||
|
Event,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="options"
|
||||||
|
)
|
||||||
name = models.CharField("Option", max_length=200)
|
name = models.CharField("Option", max_length=200)
|
||||||
multi_choices = models.BooleanField("Choix multiples", default=False)
|
multi_choices = models.BooleanField("Choix multiples", default=False)
|
||||||
|
|
||||||
|
@ -152,7 +167,11 @@ class EventOption(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class EventOptionChoice(models.Model):
|
class EventOptionChoice(models.Model):
|
||||||
event_option = models.ForeignKey(EventOption, related_name="choices")
|
event_option = models.ForeignKey(
|
||||||
|
EventOption,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="choices"
|
||||||
|
)
|
||||||
value = models.CharField("Valeur", max_length=200)
|
value = models.CharField("Valeur", max_length=200)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -165,8 +184,14 @@ class EventOptionChoice(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class EventRegistration(models.Model):
|
class EventRegistration(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(
|
||||||
event = models.ForeignKey(Event)
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
event = models.ForeignKey(
|
||||||
|
Event,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
options = models.ManyToManyField(EventOptionChoice)
|
options = models.ManyToManyField(EventOptionChoice)
|
||||||
filledcomments = models.ManyToManyField(EventCommentField,
|
filledcomments = models.ManyToManyField(EventCommentField,
|
||||||
through=EventCommentValue)
|
through=EventCommentValue)
|
||||||
|
@ -197,7 +222,11 @@ class Survey(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class SurveyQuestion(models.Model):
|
class SurveyQuestion(models.Model):
|
||||||
survey = models.ForeignKey(Survey, related_name="questions")
|
survey = models.ForeignKey(
|
||||||
|
Survey,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="questions"
|
||||||
|
)
|
||||||
question = models.CharField("Question", max_length=200)
|
question = models.CharField("Question", max_length=200)
|
||||||
multi_answers = models.BooleanField("Choix multiples", default=False)
|
multi_answers = models.BooleanField("Choix multiples", default=False)
|
||||||
|
|
||||||
|
@ -210,7 +239,11 @@ class SurveyQuestion(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class SurveyQuestionAnswer(models.Model):
|
class SurveyQuestionAnswer(models.Model):
|
||||||
survey_question = models.ForeignKey(SurveyQuestion, related_name="answers")
|
survey_question = models.ForeignKey(
|
||||||
|
SurveyQuestion,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="answers"
|
||||||
|
)
|
||||||
answer = models.CharField("Réponse", max_length=200)
|
answer = models.CharField("Réponse", max_length=200)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -222,8 +255,14 @@ class SurveyQuestionAnswer(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class SurveyAnswer(models.Model):
|
class SurveyAnswer(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(
|
||||||
survey = models.ForeignKey(Survey)
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
survey = models.ForeignKey(
|
||||||
|
Survey,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
answers = models.ManyToManyField(SurveyQuestionAnswer,
|
answers = models.ManyToManyField(SurveyQuestionAnswer,
|
||||||
related_name="selected_by")
|
related_name="selected_by")
|
||||||
|
|
||||||
|
@ -240,7 +279,10 @@ class SurveyAnswer(models.Model):
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class CalendarSubscription(models.Model):
|
class CalendarSubscription(models.Model):
|
||||||
token = models.UUIDField()
|
token = models.UUIDField()
|
||||||
user = models.OneToOneField(User)
|
user = models.OneToOneField(
|
||||||
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
other_shows = models.ManyToManyField(Spectacle)
|
other_shows = models.ManyToManyField(Spectacle)
|
||||||
subscribe_to_events = models.BooleanField(default=True)
|
subscribe_to_events = models.BooleanField(default=True)
|
||||||
subscribe_to_my_shows = models.BooleanField(default=True)
|
subscribe_to_my_shows = models.BooleanField(default=True)
|
||||||
|
|
|
@ -35,8 +35,15 @@ class PetitCoursSubject(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class PetitCoursAbility(models.Model):
|
class PetitCoursAbility(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(
|
||||||
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_("Matière"))
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
matiere = models.ForeignKey(
|
||||||
|
PetitCoursSubject,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name=_("Matière")
|
||||||
|
)
|
||||||
niveau = models.CharField(_("Niveau"),
|
niveau = models.CharField(_("Niveau"),
|
||||||
choices=LEVELS_CHOICES,
|
choices=LEVELS_CHOICES,
|
||||||
max_length=choices_length(LEVELS_CHOICES))
|
max_length=choices_length(LEVELS_CHOICES))
|
||||||
|
@ -84,7 +91,11 @@ class PetitCoursDemande(models.Model):
|
||||||
remarques = models.TextField(_("Remarques et précisions"), blank=True)
|
remarques = models.TextField(_("Remarques et précisions"), blank=True)
|
||||||
|
|
||||||
traitee = models.BooleanField(_("Traitée"), default=False)
|
traitee = models.BooleanField(_("Traitée"), default=False)
|
||||||
traitee_par = models.ForeignKey(User, blank=True, null=True)
|
traitee_par = models.ForeignKey(
|
||||||
|
User,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
blank=True, null=True
|
||||||
|
)
|
||||||
processed = models.DateTimeField(_("Date de traitement"),
|
processed = models.DateTimeField(_("Date de traitement"),
|
||||||
blank=True, null=True)
|
blank=True, null=True)
|
||||||
created = models.DateTimeField(_("Date de création"), auto_now_add=True)
|
created = models.DateTimeField(_("Date de création"), auto_now_add=True)
|
||||||
|
@ -126,9 +137,20 @@ class PetitCoursDemande(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class PetitCoursAttribution(models.Model):
|
class PetitCoursAttribution(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(
|
||||||
demande = models.ForeignKey(PetitCoursDemande, verbose_name=_("Demande"))
|
User,
|
||||||
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_("Matière"))
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
demande = models.ForeignKey(
|
||||||
|
PetitCoursDemande,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name=_("Demande")
|
||||||
|
)
|
||||||
|
matiere = models.ForeignKey(
|
||||||
|
PetitCoursSubject,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name=_("Matière")
|
||||||
|
)
|
||||||
date = models.DateTimeField(_("Date d'attribution"), auto_now_add=True)
|
date = models.DateTimeField(_("Date d'attribution"), auto_now_add=True)
|
||||||
rank = models.IntegerField("Rang dans l'email")
|
rank = models.IntegerField("Rang dans l'email")
|
||||||
selected = models.BooleanField(_("Sélectionné par le demandeur"),
|
selected = models.BooleanField(_("Sélectionné par le demandeur"),
|
||||||
|
@ -145,8 +167,15 @@ class PetitCoursAttribution(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class PetitCoursAttributionCounter(models.Model):
|
class PetitCoursAttributionCounter(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(
|
||||||
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_("Matiere"))
|
User,
|
||||||
|
on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
matiere = models.ForeignKey(
|
||||||
|
PetitCoursSubject,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
verbose_name=_("Matiere")
|
||||||
|
)
|
||||||
count = models.IntegerField("Nombre d'envois", default=0)
|
count = models.IntegerField("Nombre d'envois", default=0)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -21,7 +21,10 @@ class Migration(migrations.Migration):
|
||||||
('occupation', models.CharField(choices=[('exterieur', 'Extérieur'), ('1A', '1A'), ('2A', '2A'), ('3A', '3A'), ('4A', '4A'), ('archicube', 'Archicube'), ('doctorant', 'Doctorant'), ('CST', 'CST')], verbose_name='Occupation', max_length=9, default='1A')),
|
('occupation', models.CharField(choices=[('exterieur', 'Extérieur'), ('1A', '1A'), ('2A', '2A'), ('3A', '3A'), ('4A', '4A'), ('archicube', 'Archicube'), ('doctorant', 'Doctorant'), ('CST', 'CST')], verbose_name='Occupation', max_length=9, default='1A')),
|
||||||
('departement', models.CharField(verbose_name='Département', max_length=50, blank=True)),
|
('departement', models.CharField(verbose_name='Département', max_length=50, blank=True)),
|
||||||
('comments', models.TextField(verbose_name="Commentaires visibles par l'utilisateur", blank=True)),
|
('comments', models.TextField(verbose_name="Commentaires visibles par l'utilisateur", blank=True)),
|
||||||
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, related_name='profile')),
|
('user', models.OneToOneField(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
related_name='profile')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Profil',
|
'verbose_name': 'Profil',
|
||||||
|
|
|
@ -17,9 +17,13 @@ OCCUPATION_CHOICES = (
|
||||||
('CST', _("CST")),
|
('CST', _("CST")),
|
||||||
)
|
)
|
||||||
|
|
||||||
class Profile(models.Model):
|
|
||||||
user = models.OneToOneField(User, related_name="profile")
|
|
||||||
|
|
||||||
|
class Profile(models.Model):
|
||||||
|
user = models.OneToOneField(
|
||||||
|
User,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="profile"
|
||||||
|
)
|
||||||
login_clipper = models.CharField("Login clipper", max_length=8, blank=True)
|
login_clipper = models.CharField("Login clipper", max_length=8, blank=True)
|
||||||
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
||||||
occupation = models.CharField(_("Occupation"),
|
occupation = models.CharField(_("Occupation"),
|
||||||
|
@ -39,6 +43,7 @@ class Profile(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.username
|
return self.user.username
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=User)
|
@receiver(post_save, sender=User)
|
||||||
def create_user_profile(sender, instance, created, **kwargs):
|
def create_user_profile(sender, instance, created, **kwargs):
|
||||||
if created:
|
if created:
|
||||||
|
|
|
@ -15,6 +15,9 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='account',
|
model_name='account',
|
||||||
name='cofprofile',
|
name='cofprofile',
|
||||||
field=models.OneToOneField(to='gestion.Profile', related_name='account_kfet'),
|
field=models.OneToOneField(
|
||||||
|
to='gestion.Profile',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='account_kfet'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue