Add fields (ext_id, sector, short_name) to Corporation
This commit is contained in:
parent
98584f7208
commit
5cf2e5d8d5
4 changed files with 39 additions and 3 deletions
|
|
@ -55,10 +55,11 @@ class ContactInline(admin.StackedInline):
|
|||
extra = 1
|
||||
|
||||
class CorporationAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'pcode', 'city')
|
||||
list_display = ('name', 'short_name', 'pcode', 'city')
|
||||
list_editable = ('short_name',) # Temporarily?
|
||||
search_fields = ('name', 'pcode', 'city')
|
||||
ordering = ('name',)
|
||||
fields = ('name', 'typ', 'street', ('pcode', 'city'), ('tel', 'email'),
|
||||
fields = (('name', 'short_name', 'sector'), ('typ', 'ext_id'), 'street', ('pcode', 'city'), ('tel', 'email'),
|
||||
'web', 'archived')
|
||||
inlines = [ContactInline]
|
||||
|
||||
|
|
|
|||
29
stages/migrations/0003_add_corp_fields.py
Normal file
29
stages/migrations/0003_add_corp_fields.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stages', '0002_corpcontact_ext_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='corporation',
|
||||
name='ext_id',
|
||||
field=models.IntegerField(verbose_name='ID externe', null=True, blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='corporation',
|
||||
name='sector',
|
||||
field=models.CharField(max_length=40, verbose_name='Secteur', blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='corporation',
|
||||
name='short_name',
|
||||
field=models.CharField(max_length=40, verbose_name='Nom court', blank=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -113,7 +113,10 @@ class Referent(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)
|
||||
short_name = models.CharField(max_length=40, blank=True, verbose_name='Nom court')
|
||||
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')
|
||||
pcode = models.CharField(max_length=4, verbose_name='Code postal')
|
||||
|
|
@ -128,7 +131,8 @@ class Corporation(models.Model):
|
|||
ordering = ('name',)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
sect = ' (%s)' % self.sector if self.sector else ''
|
||||
return "%s%s, %s %s" % (self.name, sect, self.pcode, self.city)
|
||||
|
||||
|
||||
class CorpContact(models.Model):
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ EXPORT_FIELDS = [
|
|||
('Prénom référent', 'referent__first_name'), ('Nom référent', 'referent__last_name'),
|
||||
('Courriel référent', 'referent__email'),
|
||||
('Institution', 'availability__corporation__name'),
|
||||
('ID externe Inst.', 'availability__corporation__ext_id'),
|
||||
('Rue Inst.', 'availability__corporation__street'),
|
||||
('NPA Inst.', 'availability__corporation__pcode'),
|
||||
('Ville Inst.', 'availability__corporation__city'),
|
||||
|
|
@ -222,6 +223,7 @@ EXPORT_FIELDS = [
|
|||
('Civilité contact', 'availability__contact__title'),
|
||||
('Prénom contact', 'availability__contact__first_name'),
|
||||
('Nom contact', 'availability__contact__last_name'),
|
||||
('ID externe contact', 'availability__contact__ext_id'),
|
||||
('Tél contact', 'availability__contact__tel'),
|
||||
('Courriel contact', 'availability__contact__email'),
|
||||
('Courriel contact - copie', None),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue