models.py 1.95 KB
Newer Older
1
from django.db import models
2
from django.utils.translation import ugettext as _
3

4
COUNTRIES = (
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    ('BE', _('Belgium')),
    ('BG', _('Bulgaria')),
    ('CZ', _('Czech Republic')),
    ('DK', _('Denmark')),
    ('DE', _('Germany')),
    ('EE', _('Estonia')),
    ('IE', _('Ireland')),
    ('EL', _('Greece')),
    ('ES', _('Spain')),
    ('FR', _('France')),
    ('IT', _('Italy')),
    ('CY', _('Cyprus')),
    ('LV', _('Latvia')),
    ('LT', _('Lithuania')),
    ('LU', _('Luxembourg')),
    ('HU', _('Hungary')),
    ('MT', _('Malta')),
    ('NL', _('Netherlands')),
    ('AT', _('Austria')),
    ('PL', _('Poland')),
    ('PT', _('Portugal')),
    ('RO', _('Romania')),
    ('SI', _('Slovenia')),
    ('SK', _('Slovakia')),
    ('FI', _('Finland')),
    ('SE', _('Sweden')),
    ('UK', _('United Kingdom ')),
    )

RESOURCES = (
stef's avatar
stef committed
35 36 37 38 39 40
    ('port', _('port')),
    ('protocol', _('protocol')),
    ('service', _('service')),
    ('site', _('site')),
    ('user', _('user')),
    ('ip', _('ip')),
41 42
    )
TYPES = (
stef's avatar
stef committed
43 44
    ('blocking', _('Blocking')),
    ('throttling', _('Throttling')),
45 46
    )
MEDIA = (
stef's avatar
stef committed
47 48
    ('fixed', _('Fixed')),
    ('mobile', _('Mobile')),
49
    )
50 51

class Violation(models.Model):
52 53 54
    country = models.CharField(max_length=2, choices=COUNTRIES)
    operator = models.CharField(max_length=256)
    contract = models.CharField(max_length=256)
stef's avatar
stef committed
55 56 57
    resource = models.CharField(max_length=20, choices=RESOURCES)
    type = models.CharField(max_length=20, choices=TYPES)
    media = models.CharField( max_length=20, choices=MEDIA)
58 59 60 61
    temporary = models.BooleanField( )
    contractual = models.BooleanField()
    contract_excerpt = models.TextField()
    loophole = models.BooleanField()
stef's avatar
stef committed
62 63 64 65 66 67 68 69 70 71

class Comment(models.Model):
    submitter = models.EmailField()
    comment = models.TextField()
    timestamp = models.DateField()
    violation = models.ForeignKey(Violation)

class Attachment(models.Model):
    storage = models.FileField(upload_to='static')
    comment = models.ForeignKey(Comment)