models.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. from __future__ import unicode_literals
  2. from django.db import models
  3. from .fields import CommaSeparatedCharField
  4. class Contrib(models.Model):
  5. CONTRIB_CONNECT = 'connect'
  6. CONTRIB_SHARE = 'share'
  7. id = models.AutoField(primary_key=True, blank=False, null=False)
  8. name = models.CharField(
  9. 'Nom / Pseudo',
  10. max_length=30)
  11. contrib_type = models.CharField(
  12. 'Type de contribution',
  13. max_length=10, choices=(
  14. (CONTRIB_CONNECT, 'Me raccorder au réseau expérimental'),
  15. (CONTRIB_SHARE, 'Partager une partie de ma connexion')
  16. ))
  17. latitude = models.FloatField(blank=True, null=True)
  18. longitude = models.FloatField(blank=True, null=True)
  19. phone = models.CharField(
  20. 'Téléphone',
  21. max_length=30, blank=True, default='')
  22. email = models.EmailField(blank=True)
  23. access_type = models.CharField(
  24. 'Type de connexion',
  25. max_length=10, blank=True, choices=(
  26. ('vdsl', 'ADSL'),
  27. ('vdsl', 'VDSL'),
  28. ('fiber', 'Fibre optique'),
  29. ('cable', 'Coaxial (FTTLA)'),
  30. ))
  31. connect_local = models.NullBooleanField(
  32. 'Accès internet',
  33. default=False, null=True)
  34. connect_internet = models.NullBooleanField(
  35. 'Services locaux',
  36. default=False, null=True)
  37. bandwidth = models.FloatField(
  38. 'débit total',
  39. blank=True, null=True)
  40. share_part = models.FloatField(
  41. 'débit partagé',
  42. blank=True, null=True)
  43. floor = models.PositiveIntegerField(
  44. 'étage',
  45. blank=True, null=True)
  46. floor_total = models.PositiveIntegerField(
  47. "mombre d'étages",
  48. blank=True, null=True)
  49. orientations = CommaSeparatedCharField(
  50. blank=True, null=True, max_length=100)
  51. roof = models.BooleanField(
  52. 'accès au toît',
  53. default=False)
  54. comment = models.TextField(
  55. 'commentaire',
  56. blank=True, null=True)
  57. privacy_name = models.BooleanField(
  58. 'nom/pseudo public',
  59. default=False)
  60. privacy_email = models.BooleanField(
  61. 'email public',
  62. default=False)
  63. privacy_coordinates = models.BooleanField(
  64. 'coordonnées GPS publiques',
  65. default=True)
  66. privacy_place_details = models.BooleanField(
  67. 'étage/orientations publiques',
  68. default=True)
  69. privacy_comment = models.BooleanField(
  70. 'commentaire public',
  71. default=False)
  72. date = models.DateTimeField(auto_now_add=True)
  73. class Meta:
  74. managed = True
  75. db_table = 'contribs'
  76. verbose_name = 'contribution'
  77. def __str__(self):
  78. return '#{} {}'.format(self.pk, self.name)