models.py 2.44 KB
Newer Older
1
2
3
4
5
from django.db import models

# Create your models here.

class Attachment(models.Model):
stef's avatar
stef committed
6
    attachment = models.FileField(upload_to='static')
7
8
9
10

class Comment(models.Model):
    submitter = models.EmailField()
    comment = models.TextField()
stef's avatar
stef committed
11
12
    date = models.DateField()
    attachments = models.ForeignKey(Attachment)
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

class Violation(models.Model):
    COUNTRIES = (
        # TODO complete and sort
        ('A', 'Austria'),
        ('B', 'Belgium'),
        ('CZ', 'Czech Republic'),
        ('HU', 'Hungary'),
        ('RO', 'Romania'),
        ('SE', 'Sweden'),
        ('PL', 'Poland'),
        ('ES', 'Spain'),
        ('PT', 'Portugal'),
        ('I', 'Italy'),
        ('DE', 'Germany'),
        ('SK', 'Slovakia'),
        ('FR', 'France'),
    )
    RESOURCES = (
        ('1', 'port'),
        ('2', 'protocol'),
        ('3', 'service'),
        ('4', 'site'),
        ('5', 'user'),
        ('6', 'ip'),
    )
    TYPES = (
        ('1', 'Blocking'),
        ('2', 'Throttling'),
    )
    MEDIA = (
        ('1', 'Fixed'),
        ('2', 'Mobile'),
    )
stef's avatar
stef committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    country = models.CharField(max_length=2,
                               choices=COUNTRIES,
                               help_text='',
                               )
    operator = models.CharField(max_length=256,
                                help_text='')
    contract = models.CharField(max_length=256,
                                help_text='type of offer, i.e. the name of the subscription')
    comments = models.ForeignKey(Comment,
                                 help_text='')
    resource = models.CharField(blank=True,
                                max_length=1,
                                choices=RESOURCES,
                                help_text='')
    type = models.CharField(blank=True,
                            max_length=1,
                            choices=RESOURCES,
                            help_text='')
    media = models.CharField(blank=True,
                             max_length=1,
                             choices=MEDIA,
                             help_text='')
    temporary = models.BooleanField(blank=True,
                                    help_text='')
    contractual = models.BooleanField(blank=True,
                                      help_text='')
    contract_excerpt = models.TextField(blank=True,
                                        help_text='')
    loophole = models.BooleanField(blank=True,
                                   help_text='')