0001-misc-complete-family-migration-62194.patch
passerelle/apps/family/migrations/0011_auto_20200803_2326.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
# Generated by Django 1.11.18 on 2020-08-03 21:26 |
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 |
from passerelle.apps.family.models import FILE_FORMATS |
|
8 | ||
7 | 9 | |
8 | 10 |
class Migration(migrations.Migration): |
9 | 11 | |
10 | 12 |
dependencies = [ |
11 | 13 |
('family', '0010_auto_20190209_0946'), |
12 | 14 |
] |
13 | 15 | |
14 | 16 |
operations = [ |
... | ... | |
30 | 32 |
model_name='genericfamily', |
31 | 33 |
name='archive', |
32 | 34 |
field=models.FileField(max_length=256, upload_to='archives', verbose_name='Data Archive'), |
33 | 35 |
), |
34 | 36 |
migrations.AlterField( |
35 | 37 |
model_name='genericfamily', |
36 | 38 |
name='file_format', |
37 | 39 |
field=models.CharField( |
38 |
choices=[ |
|
39 |
('native', 'Native'), |
|
40 |
('concerto_fondettes', 'Concerto extract from Fondettes'), |
|
41 |
('opus_fondettes', 'Opus extract from Fondettes'), |
|
42 |
('concerto_orleans', 'Concerto extract from Orléans'), |
|
43 |
], |
|
40 |
choices=FILE_FORMATS, |
|
44 | 41 |
default='native', |
45 | 42 |
max_length=40, |
46 | 43 |
verbose_name='File Format', |
47 | 44 |
), |
48 | 45 |
), |
49 | 46 |
migrations.AlterField( |
50 | 47 |
model_name='invoice', |
51 | 48 |
name='amount', |
passerelle/apps/family/models.py | ||
---|---|---|
38 | 38 |
SEXES = ( |
39 | 39 |
('M', _('Male')), |
40 | 40 |
('F', _('Female')), |
41 | 41 |
) |
42 | 42 | |
43 | 43 |
DATE_FORMAT = '%Y-%m-%d' |
44 | 44 |
DATETIME_FORMAT = DATE_FORMAT + 'T%H:%M:%S' |
45 | 45 | |
46 |
FILE_FORMATS = ( |
|
47 |
('native', _('Native')), |
|
48 |
('concerto_fondettes', _('Concerto extract from Fondettes (legacy)')), |
|
49 |
('opus_fondettes', _('Opus extract from Fondettes')), |
|
50 |
('concerto_orleans', _('Concerto extract from Orléans')), |
|
51 |
('egee_thonon', _('Egee Invoices from Thonon Agglomération')), |
|
52 |
) |
|
53 | ||
46 | 54 | |
47 | 55 |
def get_date(dt): |
48 | 56 |
if isinstance(dt, date): |
49 | 57 |
return dt |
50 | 58 |
if not dt: |
51 | 59 |
return None |
52 | 60 |
return datetime.strptime(dt, DATE_FORMAT).date() |
53 | 61 | |
... | ... | |
147 | 155 | |
148 | 156 | |
149 | 157 |
class GenericFamily(BaseResource): |
150 | 158 |
category = _('Business Process Connectors') |
151 | 159 |
archive = models.FileField(_('Data Archive'), upload_to='archives', max_length=256) |
152 | 160 |
file_format = models.CharField( |
153 | 161 |
_('File Format'), |
154 | 162 |
max_length=40, |
155 |
choices=( |
|
156 |
('native', _('Native')), |
|
157 |
('concerto_fondettes', _('Concerto extract from Fondettes (legacy)')), |
|
158 |
('opus_fondettes', _('Opus extract from Fondettes')), |
|
159 |
('concerto_orleans', _(u'Concerto extract from Orléans')), |
|
160 |
('egee_thonon', _(u'Egee Invoices from Thonon Agglomération')), |
|
161 |
), |
|
163 |
choices=FILE_FORMATS, |
|
162 | 164 |
default='native', |
163 | 165 |
) |
164 | 166 | |
165 | 167 |
class Meta: |
166 | 168 |
verbose_name = _('Generic Family Connector') |
167 | 169 | |
168 | 170 |
@classmethod |
169 | 171 |
def get_verbose_name(cls): |
170 |
- |