~0atman/ubuntu-partner-website/trunk

1 by Tristram Oaten
initial fenchurch build, no models
1
from django.db import models
2
3
4
class PartnerModel(models.Model):
5
    "Partner metadata"
6
7
    name = models.CharField(max_length=200)
4 by Tristram Oaten
v1 models
8
    created_on = models.DateTimeField(auto_now_add=True, blank=True)
14 by Tristram Oaten
shiny admin
9
    created_by = models.CharField(max_length=200, blank=True, default="TEST_USER")
4 by Tristram Oaten
v1 models
10
    updated_on = models.DateTimeField(auto_now=True, blank=True)
14 by Tristram Oaten
shiny admin
11
    updated_by = models.CharField(max_length=200, blank=True, default="TEST_USER")
4 by Tristram Oaten
v1 models
12
13
    class Meta:
14
        abstract = True
15
16
    def __unicode__(self):
14 by Tristram Oaten
shiny admin
17
        return unicode(self.name)
4 by Tristram Oaten
v1 models
18
19
20
class Quote(PartnerModel):
21
    text = models.TextField(blank=True)
22
    attribution = models.CharField(max_length=200)
23
24
25
class Link(PartnerModel):
26
    url = models.URLField()
27
    text = models.TextField()
28
29
30
class InsightsTag(PartnerModel):
31
    tag = models.TextField()
32
33
34
class Text(PartnerModel):
35
    image = models.URLField()
36
    header = models.TextField()
37
    body = models.TextField()
38
    url = models.URLField()
39
40
41
class CategoryModel(models.Model):
42
    name = models.CharField(max_length=200)
43
44
    class Meta:
45
        abstract = True
46
47
    def __unicode__(self):
48
        return str(self.name)
2 by Tristram Oaten
added models, settings for the same
49
50
51
class Category(CategoryModel):
52
    pass
53
54
55
class IndustrySector(CategoryModel):
56
    pass
57
58
59
class Programme(CategoryModel):
60
    pass
61
62
63
class ServiceOffered(CategoryModel):
64
    pass
65
66
67
class Region(CategoryModel):
68
    pass
69
70
1 by Tristram Oaten
initial fenchurch build, no models
71
class Partner(PartnerModel):
2 by Tristram Oaten
added models, settings for the same
72
    logo = models.URLField()
1 by Tristram Oaten
initial fenchurch build, no models
73
    external_page = models.CharField(max_length=200)
74
    external_fallback = models.CharField(max_length=200)
75
    short_description = models.CharField(max_length=200)
76
    long_description = models.TextField()
77
    featured = models.BooleanField()
14 by Tristram Oaten
shiny admin
78
    generate_page = models.BooleanField()
4 by Tristram Oaten
v1 models
79
    category = models.ManyToManyField(
80
        Category,
81
        related_name='partners'
82
    )
83
    industry_sector = models.ManyToManyField(
84
        IndustrySector,
85
        related_name='partners'
86
    )
87
    programme = models.ManyToManyField(
88
        Programme,
89
        related_name='partners'
90
    )
91
    service_offered = models.ManyToManyField(
92
        ServiceOffered,
93
        related_name='partners'
94
    )
95
    region = models.ManyToManyField(
96
        Region,
97
        related_name='partners'
98
    )
99
    quote = models.ManyToManyField(
100
        Quote,
101
        related_name='partners'
102
    )
103
    link = models.ManyToManyField(
104
        Link,
105
        related_name='partners'
106
    )
107
    insights_tag = models.ManyToManyField(
108
        InsightsTag,
109
        related_name='partners'
110
    )
111
    text = models.ManyToManyField(
112
        Text,
113
        related_name='partners'
114
    )
14 by Tristram Oaten
shiny admin
115
    notes = models.TextField(blank=True)