models.py 2.6 KB

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