models.py 1.56 KB
Newer Older
Aymeric Barantal's avatar
Aymeric Barantal committed
1
2
3
4
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
from django.db import models
from campaign.organization.models import Organization


class Contact(models.Model):
    """Contact model. Person to be call by users"""
    id = models.AutoField(primary_key=True)
    first_name = models.CharField(max_length=64)
    last_name = models.CharField(max_length=64)
    phone = models.CharField(max_length=32)
    twitter = models.CharField(max_length=64)
    mail = models.CharField(max_length=255)


class Group(models.Model):
    """Group model to qualify contacts"""
    id = models.AutoField(primary_key=True)
    organisation_id = models.ForeignKey(Organization)
    name = models.CharField(max_length=64)
    type = models.CharField(max_length=255)
    media = models.CharField(max_length=255)
    contacts = models.ManyToManyField(Contact)


class Campaign(models.Model):
    """Campaign model, describe what have to be achieved"""
    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=255)
    description = models.CharField(max_length=512)
    start_date = models.DateTimeField()
    end_date = models.DateTimeField()
    default_lang = models.CharField(max_length=5)


class Argumentary(models.Model):
    id = models.AutoField(primary_key=True)
    campaign_id = models.ForeignKey(Campaign)
    lang = models.CharField(max_length=255)


class CampaignContact(models.Model):
    """List contact related to a campaign with a given weight"""
    id = models.AutoField(primary_key=True)
    campaign_id = models.ForeignKey(Campaign)
    contact_id = models.ForeignKey(Contact)
    weight = models.IntegerField(default=0)