Add link between corporation and its parent
This commit is contained in:
parent
d45742d88f
commit
73e3680da0
3 changed files with 22 additions and 2 deletions
|
|
@ -70,8 +70,8 @@ class CorporationAdmin(admin.ModelAdmin):
|
|||
list_editable = ('short_name',) # Temporarily?
|
||||
search_fields = ('name', 'pcode', 'city')
|
||||
ordering = ('name',)
|
||||
fields = (('name', 'short_name', 'sector'), ('typ', 'ext_id'), 'street', ('pcode', 'city'), ('tel', 'email'),
|
||||
'web', 'archived')
|
||||
fields = (('name', 'short_name'), 'parent', ('sector', 'typ', 'ext_id'),
|
||||
'street', ('pcode', 'city'), ('tel', 'email'), 'web', 'archived')
|
||||
inlines = [ContactInline]
|
||||
|
||||
|
||||
|
|
|
|||
19
stages/migrations/0006_corporation_parent.py
Normal file
19
stages/migrations/0006_corporation_parent.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 1.9.1 on 2016-01-18 12:23
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stages', '0005_extended_contact_email'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='corporation',
|
||||
name='parent',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
|
||||
to='stages.Corporation', verbose_name='Institution mère'),
|
||||
),
|
||||
]
|
||||
|
|
@ -121,6 +121,7 @@ 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)
|
||||
short_name = models.CharField(max_length=40, blank=True, verbose_name='Nom court')
|
||||
parent = models.ForeignKey('self', null=True, blank=True, verbose_name='Institution mère', on_delete=models.SET_NULL)
|
||||
sector = models.CharField(max_length=40, blank=True, verbose_name='Secteur')
|
||||
typ = models.CharField(max_length=40, blank=True, verbose_name='Type de structure')
|
||||
street = models.CharField(max_length=100, blank=True, verbose_name='Rue')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue