Commit 6dee8944 authored by Damien Nicolas's avatar Damien Nicolas
Browse files

Added first draft of FDNWhiteLabel model and admin

parent 9e13381e
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from polymorphic.admin import PolymorphicChildModelAdmin
from coin.configuration.admin import ConfigurationAdminFormMixin
from fdnwhitelabel.models import FDNWhiteLabel
class FDNWhiteLabelInline(admin.StackedInline):
model = FDNWhiteLabel
class FDNWhiteLabelAdmin(ConfigurationAdminFormMixin, PolymorphicChildModelAdmin):
base_model = FDNWhiteLabel
# Used for form inclusion (when browsing a subscription object in the
# admin, SimpleDSLInline will be displayed)
inline = FDNWhiteLabelInline
# Since we don't provide a view, don't display a "view on site" link
# in the admin.
view_on_site = False
# Register your models here.
admin.site.register(FDNWhiteLabel, FDNWhiteLabelAdmin)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('configuration', '0003_configuration_comment'),
]
operations = [
migrations.CreateModel(
name='FDNWhiteLabel',
fields=[
('configuration_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='configuration.Configuration')),
('phone_number', models.CharField(help_text='Phone number associated to the DSL line', max_length=20, verbose_name='phone number')),
('address', models.TextField(null=True, verbose_name='adresse postale', blank=True)),
('postal_code', models.CharField(blank=True, max_length=5, null=True, verbose_name='code postal', validators=[django.core.validators.RegexValidator(regex='^\\d{5}$', message='Code postal non valide.')])),
('city', models.CharField(max_length=200, null=True, verbose_name='commune', blank=True)),
('ppp_login', models.CharField(max_length=200, null=True, verbose_name='identifiant PPP', blank=True)),
('ppp_password', models.CharField(max_length=200, null=True, verbose_name='mot de passe PPP', blank=True)),
],
options={
'verbose_name': 'marque blanche FDN',
},
bases=('configuration.configuration',),
),
]
......@@ -19,16 +19,24 @@ class FDNWhiteLabel(Configuration):
url_namespace = "fdn"
phone_number = models.CharField(max_length=20,
verbose_name='phone number',
help_text="Phone number associated to the DSL line")
help_text='Phone number associated to the '
'DSL line')
address = models.TextField(
verbose_name='adresse postale', blank=True, null=True)
postal_code = models.CharField(max_length=5, blank=True, null=True,
validators=[RegexValidator(regex=r'^\d{5}$',
message='Code postal non valide.')],
validators=[
RegexValidator(regex=r'^\d{5}$',
message='Code postal '
'non valide.')
],
verbose_name='code postal')
city = models.CharField(max_length=200, blank=True, null=True,
verbose_name='commune')
ppp_login = models.CharField(max_length=200, blank=True, null=True,
verbose_name='identifiant PPP')
ppp_password = models.CharField(max_length=200, blank=True, null=True,
verbose_name='mot de passe PPP')
def __unicode__(self):
return self.phone_number
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment