models.py 1.9 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    ('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 = (
    ('1', _('port')),
    ('2', _('protocol')),
    ('3', _('service')),
    ('4', _('site')),
    ('5', _('user')),
    ('6', _('ip')),
    )
TYPES = (
    ('1', _('Blocking')),
    ('2', _('Throttling')),
    )
MEDIA = (
    ('1', _('Fixed')),
    ('2', _('Mobile')),
49
    )
50
51

class Attachment(models.Model):
stef's avatar
stef committed
52
    attachment = models.FileField(upload_to='static')
53
54
55
56

class Comment(models.Model):
    submitter = models.EmailField()
    comment = models.TextField()
stef's avatar
stef committed
57
58
    date = models.DateField()
    attachments = models.ForeignKey(Attachment)
59
60

class Violation(models.Model):
61
62
63
64
65
66
67
68
69
70
71
    country = models.CharField(max_length=2, choices=COUNTRIES)
    operator = models.CharField(max_length=256)
    contract = models.CharField(max_length=256)
    comments = models.ForeignKey(Comment)
    resource = models.CharField(max_length=1, choices=RESOURCES)
    type = models.CharField(max_length=1, choices=TYPES)
    media = models.CharField( max_length=1, choices=MEDIA)
    temporary = models.BooleanField( )
    contractual = models.BooleanField()
    contract_excerpt = models.TextField()
    loophole = models.BooleanField()