models: add field enterprise_name, enterprise_siret and enterprise_id

This commit is contained in:
Benjamin Dauvergne 2014-03-18 13:57:00 +01:00
parent b5cbf318b2
commit 8bfafec7e5
4 changed files with 301 additions and 81 deletions

View File

@ -39,6 +39,7 @@ if settings.AUTH_USER_MODEL == 'portail_citoyen.Citoyen':
(_('Personal info'), {'fields': ('first_name', 'last_name', (_('Personal info'), {'fields': ('first_name', 'last_name',
'email', 'address', 'city', 'postal_code', 'phone', 'email', 'address', 'city', 'postal_code', 'phone',
'mobile')}), 'mobile')}),
(_('Enterprise account'), {'fields': ('enterprise_name', 'enterprise_siret', 'enterprise_id')}),
(_('Permissions'), {'fields': ('is_active', (_('Permissions'), {'fields': ('is_active',
'is_superuser', 'groups')}), 'is_superuser', 'groups')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}), (_('Important dates'), {'fields': ('last_login', 'date_joined')}),

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: portail_citoyen 0.1.0\n" "Project-Id-Version: portail_citoyen 0.1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-22 14:32+0100\n" "POT-Creation-Date: 2014-03-18 16:39+0100\n"
"PO-Revision-Date: 2013-09-06 14:17+0200\n" "PO-Revision-Date: 2014-03-18 16:40+0100\n"
"Last-Translator: Benjamin Dauvergne <bdauvergne@entrouvert.com>\n" "Last-Translator: Benjamin Dauvergne <bdauvergne@entrouvert.com>\n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -28,18 +28,22 @@ msgstr ""
msgid "Important dates" msgid "Important dates"
msgstr "Dates importantes" msgstr "Dates importantes"
#: admin.py:138 apps/data_source_plugin/models.py:40 #: admin.py:45
msgid "Enterprise account"
msgstr "Compte entreprise"
#: admin.py:139 apps/data_source_plugin/models.py:40
msgid "URL" msgid "URL"
msgstr "" msgstr ""
#: admin.py:170 #: admin.py:171
msgid "" msgid ""
"Unable to retrieve SAML 2.0 metadatas, please report it to an administrator" "Unable to retrieve SAML 2.0 metadatas, please report it to an administrator"
msgstr "" msgstr ""
"Impossible de récupérer les métadonnées SAML 2.0, veuillez rapporter cet " "Impossible de récupérer les métadonnées SAML 2.0, veuillez rapporter cet "
"incident à un administrateur" "incident à un administrateur"
#: admin.py:178 #: admin.py:179
#, python-format #, python-format
msgid "Unable to create the SAML 2.0 provider: %s" msgid "Unable to create the SAML 2.0 provider: %s"
msgstr "" msgstr ""
@ -48,7 +52,7 @@ msgstr ""
msgid "account form plugin" msgid "account form plugin"
msgstr "" msgstr ""
#: cms_plugins.py:73 #: cms_plugins.py:75
msgid "account management plugin" msgid "account management plugin"
msgstr "" msgstr ""
@ -88,56 +92,64 @@ msgstr "Reporter un bug"
msgid "Dashboard" msgid "Dashboard"
msgstr "Tableau de bord" msgstr "Tableau de bord"
#: models.py:15 #: models.py:23
msgid "SIRET number must contain 14 digits"
msgstr "Le SIRET doit contenir 14 chiffres"
#: models.py:28
msgid "SIRET validation code does not match"
msgstr "Votre SIRET est invalide, veuillez le vérifier."
#: models.py:32
msgctxt "person title" msgctxt "person title"
msgid "title" msgid "title"
msgstr "civilité" msgstr "civilité"
#: models.py:16 #: models.py:33
msgid "Mrs" msgid "Mrs"
msgstr "Madame" msgstr "Madame"
#: models.py:17 #: models.py:34
msgid "Mr" msgid "Mr"
msgstr "Monsieur" msgstr "Monsieur"
#: models.py:19 #: models.py:36
msgid "first name" msgid "first name"
msgstr "prénom" msgstr "prénom"
#: models.py:20 #: models.py:37
msgid "last name" msgid "last name"
msgstr "nom" msgstr "nom"
#: models.py:21 #: models.py:38
msgid "e-mail address" msgid "e-mail address"
msgstr "e-mail" msgstr "e-mail"
#: models.py:22 #: models.py:39
msgid "city" msgid "city"
msgstr "ville" msgstr "ville"
#: models.py:23 #: models.py:40
msgid "address" msgid "address"
msgstr "adresse" msgstr "adresse"
#: models.py:24 #: models.py:41
msgid "postal code" msgid "postal code"
msgstr "code postal" msgstr "code postal"
#: models.py:27 #: models.py:44
msgid "Postal code must be five numbers" msgid "Postal code must be five numbers"
msgstr "Le code postal doit comporter 5 chiffres" msgstr "Le code postal doit comporter 5 chiffres"
#: models.py:28 #: models.py:45
msgid "Invalid postal code" msgid "Invalid postal code"
msgstr "Code postal invalide" msgstr "Code postal invalide"
#: models.py:31 #: models.py:48
msgid "phone" msgid "phone"
msgstr "Téléphone fixe" msgstr "Téléphone fixe"
#: models.py:33 models.py:36 #: models.py:50 models.py:53
msgid "" msgid ""
"Phone number must start with 01, 02, 03, 04, 05, 08 or 07 and be ten digits " "Phone number must start with 01, 02, 03, 04, 05, 08 or 07 and be ten digits "
"long without spaces" "long without spaces"
@ -145,15 +157,15 @@ msgstr ""
"Les numéros de téléphone fixe doivent commencer par 01, 02, 03, 04, 05, 08 " "Les numéros de téléphone fixe doivent commencer par 01, 02, 03, 04, 05, 08 "
"ou 07 et contenir 10 chiffres sans espaces" "ou 07 et contenir 10 chiffres sans espaces"
#: models.py:37 models.py:44 #: models.py:54 models.py:61
msgid "Invalid mobile phone number" msgid "Invalid mobile phone number"
msgstr "" msgstr ""
#: models.py:38 #: models.py:55
msgid "mobile" msgid "mobile"
msgstr "Téléphone mobile" msgstr "Téléphone mobile"
#: models.py:40 models.py:43 #: models.py:57 models.py:60
msgid "" msgid ""
"Mobile phone number must start with 06 or 07 and be ten digits long without " "Mobile phone number must start with 06 or 07 and be ten digits long without "
"spaces" "spaces"
@ -162,71 +174,137 @@ msgstr ""
"contenir 10 chiffres sans espaces" "contenir 10 chiffres sans espaces"
#: models.py:62 #: models.py:62
msgid "enterprise name"
msgstr "Nom de l'entreprise"
#: models.py:64
msgid "enterprise siret"
msgstr "SIRET"
#: models.py:67
msgid "enterprise internal id"
msgstr "Identifiant interne de l'entreprise"
#: models.py:93
msgid "Enterprise Name"
msgstr "Nom de l'entreprise"
#: models.py:99
msgid "Enterprise SIRET"
msgstr "SIRET"
#: models.py:105
msgid "Enterprise ID"
msgstr "Identifiant interne de l'entreprise"
#: models.py:115
msgid "role" msgid "role"
msgstr "rôle" msgstr "rôle"
#: models.py:63 #: models.py:116
msgid "roles" msgid "roles"
msgstr "rôles" msgstr "rôles"
#: settings.py:45 #: settings.py:45
msgid "French" msgid "French"
msgstr "" msgstr "Français"
#: apps/a2_service_list_plugin/cms_plugins.py:11 #: apps/a2_service_list_plugin/cms_plugins.py:11
msgid "Authentic2 Service List Plugin" msgid "Authentic2 Service List Plugin"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/cms_plugins.py:27 #: apps/auquotidien_plugin/cms_plugins.py:63
#: apps/auquotidien_plugin/models.py:43 #: apps/auquotidien_plugin/models.py:67 apps/auquotidien_plugin/models.py:68
msgid "au-quotidien active forms plugin" msgid "au-quotidien active forms"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:18 #: apps/auquotidien_plugin/cms_plugins.py:75
#: apps/auquotidien_plugin/models.py:82
msgid "au-quotidien categories"
msgstr ""
#: apps/auquotidien_plugin/models.py:14 apps/feed_plugin/models.py:35
msgid "name"
msgstr "nom"
#: apps/auquotidien_plugin/models.py:16
msgid "active"
msgstr ""
#: apps/auquotidien_plugin/models.py:17
msgid "order"
msgstr ""
#: apps/auquotidien_plugin/models.py:19
msgid "liberty service provider for the au-quotidien service" msgid "liberty service provider for the au-quotidien service"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:20 #: apps/auquotidien_plugin/models.py:21
msgid "origin" msgid "origin"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:21 #: apps/auquotidien_plugin/models.py:22
msgid "hashing algorithm" msgid "hashing algorithm"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:23 #: apps/auquotidien_plugin/models.py:24
msgid "signature key" msgid "signature key"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:30 apps/auquotidien_plugin/models.py:37 #: apps/auquotidien_plugin/models.py:26 apps/data_source_plugin/models.py:46
msgid "verify certificate"
msgstr ""
#: apps/auquotidien_plugin/models.py:28 apps/data_source_plugin/models.py:48
msgid "allows HTTP redirections"
msgstr ""
#: apps/auquotidien_plugin/models.py:29 apps/data_source_plugin/models.py:49
msgid "it can improve latencies to forbid redirection follow"
msgstr ""
#: apps/auquotidien_plugin/models.py:31 apps/data_source_plugin/models.py:51
msgid "timeout"
msgstr ""
#: apps/auquotidien_plugin/models.py:33 apps/data_source_plugin/models.py:53
msgid "time in second to wait before failing to download a datasource"
msgstr ""
#: apps/auquotidien_plugin/models.py:50
msgid "au-quotidien API endpoint" msgid "au-quotidien API endpoint"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:31 #: apps/auquotidien_plugin/models.py:51
msgid "au-quotidien API endpoints" msgid "au-quotidien API endpoints"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:38 #: apps/auquotidien_plugin/models.py:56 apps/auquotidien_plugin/models.py:71
msgid "maximum forms"
msgstr ""
#: apps/auquotidien_plugin/models.py:39
msgid "refresh timeout" msgid "refresh timeout"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:40 apps/data_source_plugin/models.py:101 #: apps/auquotidien_plugin/models.py:57 apps/auquotidien_plugin/models.py:72
#: apps/data_source_plugin/models.py:108
msgid "Number of seconds between two web service calls" msgid "Number of seconds between two web service calls"
msgstr "" msgstr ""
#: apps/auquotidien_plugin/models.py:44 #: apps/auquotidien_plugin/models.py:61 apps/auquotidien_plugin/models.py:76
msgid "au-quotidien active forms plugins" msgid "refresh {0}"
msgstr "" msgstr ""
#: apps/data_source_plugin/cms_plugins.py:134 #: apps/auquotidien_plugin/templates/auquotidien_plugin/categories.html:2
msgid "Other procedures.."
msgstr ""
#: apps/auquotidien_plugin/templates/auquotidien_plugin/categories.html:20
msgid "All categories"
msgstr ""
#: apps/data_source_plugin/cms_plugins.py:137
msgid "Raw Inline Template Plugin" msgid "Raw Inline Template Plugin"
msgstr "" msgstr ""
#: apps/data_source_plugin/cms_plugins.py:143 #: apps/data_source_plugin/cms_plugins.py:146
msgid "Data Source Plugin" msgid "Data Source Plugin"
msgstr "" msgstr ""
@ -263,48 +341,43 @@ msgstr ""
msgid "Signature key" msgid "Signature key"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:46 #: apps/data_source_plugin/models.py:58
msgid "verify certificate"
msgstr ""
#: apps/data_source_plugin/models.py:51
msgid "You must choose a hashing algorithm if you set a signature key" msgid "You must choose a hashing algorithm if you set a signature key"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:55 #: apps/data_source_plugin/models.py:62
#, python-brace-format
msgid "Data source {name}, url: {url} mime-type: {mime_type}" msgid "Data source {name}, url: {url} mime-type: {mime_type}"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:59 #: apps/data_source_plugin/models.py:66
msgid "Data source" msgid "Data source"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:60 #: apps/data_source_plugin/models.py:67
msgid "Data sources" msgid "Data sources"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:76 #: apps/data_source_plugin/models.py:83
msgid "Overloaded template" msgid "Overloaded template"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:91 apps/data_source_plugin/models.py:95 #: apps/data_source_plugin/models.py:98 apps/data_source_plugin/models.py:102
msgid "Raw inline template plugin" msgid "Raw inline template plugin"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:92 #: apps/data_source_plugin/models.py:99
msgid "Raw inline template plugins" msgid "Raw inline template plugins"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:99 #: apps/data_source_plugin/models.py:106
msgid "Maximum entries" msgid "Maximum entries"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:100 #: apps/data_source_plugin/models.py:107
msgid "Refresh timeout" msgid "Refresh timeout"
msgstr "" msgstr ""
#: apps/data_source_plugin/models.py:108 #: apps/data_source_plugin/models.py:115
#, python-format #, python-format
msgid "DataSource with %d sources" msgid "DataSource with %d sources"
msgstr "" msgstr ""
@ -314,9 +387,8 @@ msgid "federation management plugin"
msgstr "" msgstr ""
#: apps/federation_plugin/models.py:19 #: apps/federation_plugin/models.py:19
#, fuzzy
msgid "provider restrictions" msgid "provider restrictions"
msgstr "Enregistrement réussi" msgstr "restriction sur les fournisseurs"
#: apps/federation_plugin/models.py:20 #: apps/federation_plugin/models.py:20
msgid "" msgid ""
@ -350,11 +422,11 @@ msgstr[1] ""
msgid "You have no federation currently." msgid "You have no federation currently."
msgstr "" msgstr ""
#: apps/feed_plugin/cms_plugins.py:23 #: apps/feed_plugin/cms_plugins.py:18
msgid "select user feeds" msgid "select user feeds"
msgstr "" msgstr ""
#: apps/feed_plugin/cms_plugins.py:47 #: apps/feed_plugin/cms_plugins.py:42
msgid "show user feeds" msgid "show user feeds"
msgstr "" msgstr ""
@ -362,36 +434,31 @@ msgstr ""
msgid "Your feeds" msgid "Your feeds"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:12 #: apps/feed_plugin/models.py:24
msgid "user feed subscription" msgid "user feed subscription"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:13 #: apps/feed_plugin/models.py:25
msgid "user feed subscriptions" msgid "user feed subscriptions"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:23 #: apps/feed_plugin/models.py:38
#, fuzzy
msgid "name"
msgstr "nom"
#: apps/feed_plugin/models.py:26
msgid "Color" msgid "Color"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:27 #: apps/feed_plugin/models.py:39
msgid "as an hexadecimal number" msgid "as an hexadecimal number"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:30 #: apps/feed_plugin/models.py:42
msgid "CSS classes" msgid "CSS classes"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:34 #: apps/feed_plugin/models.py:86
msgid "feed" msgid "feed"
msgstr "" msgstr ""
#: apps/feed_plugin/models.py:35 #: apps/feed_plugin/models.py:87
msgid "feeds" msgid "feeds"
msgstr "" msgstr ""
@ -417,15 +484,15 @@ msgstr ""
msgid "Logout" msgid "Logout"
msgstr "" msgstr ""
#: apps/msp/models.py:11 #: apps/msp/models.py:14
msgid "user" msgid "user"
msgstr "" msgstr ""
#: apps/msp/models.py:12 #: apps/msp/models.py:15
msgid "access grant code" msgid "access grant code"
msgstr "" msgstr ""
#: apps/msp/models.py:13 #: apps/msp/models.py:16
msgid "access token" msgid "access token"
msgstr "" msgstr ""
@ -458,12 +525,10 @@ msgid "passerelle url"
msgstr "" msgstr ""
#: apps/passerelle_register_plugin/models.py:22 #: apps/passerelle_register_plugin/models.py:22
#, fuzzy
msgid "ressources restrictions" msgid "ressources restrictions"
msgstr "Enregistrement réussi" msgstr "Enregistrement réussi"
#: apps/passerelle_register_plugin/models.py:23 #: apps/passerelle_register_plugin/models.py:23
#, fuzzy
msgid "transports restrictions" msgid "transports restrictions"
msgstr "Enregistrement réussi" msgstr "Enregistrement réussi"
@ -593,3 +658,13 @@ msgstr "Enregistrement réussi"
msgid "You are now registered. Activation email sent." msgid "You are now registered. Activation email sent."
msgstr "" msgstr ""
"Vous êtes désormais enregistré. Un courriel d'activation vous a été envoyé." "Vous êtes désormais enregistré. Un courriel d'activation vous a été envoyé."
#~ msgid "Invalid SIRET number"
#~ msgstr "Numéro de SIRET invalide"
#~ msgid "The SIRET of your enterprise"
#~ msgstr ""
#~ "Pour les entreprises étrangères utiliser 99999999999999, pour les "
#~ "porteurs de project BIC utiliser 88888888888888, pour les UMR, organismes "
#~ "de recherche ou écoles utiliser 77777777777777, pour les organismes en "
#~ "attente de mise à jour du SIRET utiliser 66666666666666."

View File

@ -0,0 +1,88 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Citoyen.enterprise_name'
db.add_column(u'portail_citoyen_citoyen', 'enterprise_name',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
# Adding field 'Citoyen.enterprise_siret'
db.add_column(u'portail_citoyen_citoyen', 'enterprise_siret',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
# Adding field 'Citoyen.enterprise_id'
db.add_column(u'portail_citoyen_citoyen', 'enterprise_id',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Citoyen.enterprise_name'
db.delete_column(u'portail_citoyen_citoyen', 'enterprise_name')
# Deleting field 'Citoyen.enterprise_siret'
db.delete_column(u'portail_citoyen_citoyen', 'enterprise_siret')
# Deleting field 'Citoyen.enterprise_id'
db.delete_column(u'portail_citoyen_citoyen', 'enterprise_id')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'portail_citoyen.citoyen': {
'Meta': {'object_name': 'Citoyen'},
'address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'backend': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'backend_id': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'blank': 'True'}),
'enterprise_id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'enterprise_name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'enterprise_siret': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'mobile': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '5', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'})
}
}
complete_apps = ['portail_citoyen']

View File

@ -1,12 +1,32 @@
import string
from django.db import models from django.db import models
from django.core.validators import RegexValidator, MinLengthValidator, \ from django.core.validators import RegexValidator, MinLengthValidator, \
MaxLengthValidator MaxLengthValidator
from django.utils.translation import ugettext_lazy as _, pgettext_lazy from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.core.exceptions import ValidationError
from authentic2.models import AbstractUser from authentic2.models import AbstractUser
def only_digits(value):
return u''.join(x for x in value if x in string.digits)
def validate_lun(value):
l = [(int(x)* (1+i%2)) for i, x in enumerate(reversed(value))]
return sum(x-9 if x > 10 else x for x in l) % 10 == 0
def validate_siret(value):
RegexValidator(r'^( *[0-9] *){14}$',
_('SIRET number must contain 14 digits'), 'coin')(value)
value = only_digits(value)
if value in ('9'*14, '8'*14, '7'*14, '6'*14):
return
if not validate_lun(value) or not validate_lun(value[:9]):
raise ValidationError(_('SIRET validation code does not match'))
class Citoyen(AbstractUser): class Citoyen(AbstractUser):
title = models.CharField(pgettext_lazy('person title', 'title'), max_length=16, blank=True, title = models.CharField(pgettext_lazy('person title', 'title'), max_length=16, blank=True,
@ -39,11 +59,25 @@ class Citoyen(AbstractUser):
RegexValidator(r'^0[67][0-9]{8}$', RegexValidator(r'^0[67][0-9]{8}$',
_('Mobile phone number must start with 06 or 07 and be ten digits long without spaces'), _('Mobile phone number must start with 06 or 07 and be ten digits long without spaces'),
_('Invalid mobile phone number')),]) _('Invalid mobile phone number')),])
enterprise_name = models.CharField(verbose_name=_('enterprise name'),
max_length=64, blank=True)
enterprise_siret = models.CharField(verbose_name=_('enterprise siret'),
max_length=20, blank=True,
validators=[validate_siret])
enterprise_id = models.CharField(verbose_name=_('enterprise internal id'),
max_length=64, blank=True)
REQUIRED_FIELDS = ['first_name', 'last_name', 'email'] def clean(self):
if self.enterprise_siret:
self.enterprise_siret = only_digits(self.enterprise_siret)
super(Citoyen, self).clean()
REQUIRED_FIELDS = ['first_name', 'last_name', 'email', 'enterprise_name', 'enterprise_siret']
USERNAME = 'username' USERNAME = 'username'
USER_PROFILE = ( 'title', 'username', 'first_name', 'last_name', 'email', USER_PROFILE = ( 'title', 'username', 'first_name', 'last_name', 'email',
'phone', 'mobile', 'address', 'postal_code', 'city', 'roles') 'phone', 'mobile', 'address', 'postal_code', 'city', 'roles',
'enterprise_name', 'enterprise_siret')
from authentic2.attribute_aggregator.core import ATTRIBUTE_MAPPING from authentic2.attribute_aggregator.core import ATTRIBUTE_MAPPING
@ -53,6 +87,28 @@ ATTRIBUTE_MAPPING['street']['profile_field_name'] = 'address'
ATTRIBUTE_MAPPING['postalCode']['profile_field_name'] = 'postal_code' ATTRIBUTE_MAPPING['postalCode']['profile_field_name'] = 'postal_code'
ATTRIBUTE_MAPPING['mobile']['profile_field_name'] = 'mobile' ATTRIBUTE_MAPPING['mobile']['profile_field_name'] = 'mobile'
ATTRIBUTE_MAPPING.update({
"enterpriseName": {
"oid": "2.5.4.7",
"display_name": _("Enterprise Name"),
"profile_field_name": "enterprise_name",
"type": "http://www.w3.org/2001/XMLSchema#string",
},
"enterpriseSIRET": {
"oid": "2.5.4.7",
"display_name": _("Enterprise SIRET"),
"profile_field_name": "enterprise_siret",
"type": "http://www.w3.org/2001/XMLSchema#string",
},
"enterpriseId": {
"oid": "2.5.4.7",
"display_name": _("Enterprise ID"),
"profile_field_name": "enterprise_id",
"type": "http://www.w3.org/2001/XMLSchema#string",
},
})
class Role(Group): class Role(Group):
class Meta: class Meta:
proxy = True proxy = True