Made corporation unique on name and city
This commit is contained in:
parent
26630687db
commit
08c7bd786f
2 changed files with 26 additions and 1 deletions
24
stages/migrations/0022_corporation_unique_name_and_city.py
Normal file
24
stages/migrations/0022_corporation_unique_name_and_city.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-19 14:22
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stages', '0021_klass_name_unique'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='corporation',
|
||||
name='name',
|
||||
field=models.CharField(max_length=100, verbose_name='Nom'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='corporation',
|
||||
unique_together=set([('name', 'city')]),
|
||||
),
|
||||
]
|
||||
|
|
@ -166,7 +166,7 @@ class Student(models.Model):
|
|||
|
||||
class Corporation(models.Model):
|
||||
ext_id = models.IntegerField(null=True, blank=True, verbose_name='ID externe')
|
||||
name = models.CharField(max_length=100, verbose_name='Nom', unique=True)
|
||||
name = models.CharField(max_length=100, verbose_name='Nom')
|
||||
short_name = models.CharField(max_length=40, blank=True, verbose_name='Nom court')
|
||||
district = models.CharField(max_length=20, blank=True, verbose_name='Canton')
|
||||
parent = models.ForeignKey('self', null=True, blank=True, verbose_name='Institution mère',
|
||||
|
|
@ -184,6 +184,7 @@ class Corporation(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Institution"
|
||||
ordering = ('name',)
|
||||
unique_together=(('name', 'city'),)
|
||||
|
||||
def __str__(self):
|
||||
sect = ' (%s)' % self.sector if self.sector else ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue