models.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import models
  4. from django.core.validators import RegexValidator
  5. from coin.configuration.models import Configuration
  6. class FDNWhiteLabel(Configuration):
  7. class Meta:
  8. verbose_name = 'marque blanche FDN'
  9. # If Django's default pluralisation is not satisfactory
  10. # verbose_name_plural = 'very many DSL lines'
  11. # URL namespace associated to this configuration type, to build URLs
  12. # in various view. Should also be defined in urls.py. Here, we don't
  13. # define any view, so there's no need for an URL namespace.
  14. url_namespace = "fdn"
  15. phone_number = models.CharField(max_length=20,
  16. verbose_name='phone number',
  17. help_text="Phone number associated to the DSL line")
  18. address = models.TextField(
  19. verbose_name='adresse postale', blank=True, null=True)
  20. postal_code = models.CharField(max_length=5, blank=True, null=True,
  21. validators=[RegexValidator(regex=r'^\d{5}$',
  22. message='Code postal non valide.')],
  23. verbose_name='code postal')
  24. city = models.CharField(max_length=200, blank=True, null=True,
  25. verbose_name='commune')
  26. def __unicode__(self):
  27. return self.phone_number
  28. def subnet_event(self):
  29. # Do something with self.ip_subnet.all() here.
  30. pass