41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def add_initial_data(apps, schema_editor):
|
|
AttributeDefinition = apps.get_model('profile', 'AttributeDefinition')
|
|
|
|
attributes = [
|
|
{'label': u'Civilité', 'name': 'title', 'kind': 'title'},
|
|
{'label': u'Prénom', 'name': 'first_name', 'required': True,
|
|
'asked_on_registration': True},
|
|
{'label': u'Nom', 'name': 'last_name', 'required': True,
|
|
'asked_on_registration': True},
|
|
{'label': u'Adresse électronique', 'name': 'email', 'kind': 'email', 'required': True},
|
|
{'label': u'Adresse', 'name': 'address'},
|
|
{'label': u'Code postal', 'name': 'zipcode'},
|
|
{'label': u'Commune', 'name': 'city'},
|
|
{'label': u'Pays', 'name': 'country', 'disabled': True},
|
|
{'label': u'Date de naissance', 'name': 'birthdate', 'kind': 'birthdate', 'disabled': True},
|
|
{'label': u'Téléphone', 'name': 'phone'},
|
|
{'label': u'Mobile', 'name': 'mobile'},
|
|
]
|
|
|
|
for i, attribute_dict in enumerate(attributes):
|
|
attribute_dict['order'] = i + 1
|
|
attr = AttributeDefinition(**attribute_dict)
|
|
attr.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('profile', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(add_initial_data),
|
|
]
|