models.py 1.07 KB
Newer Older
Aymeric Barantal's avatar
Aymeric Barantal committed
1
2
from django.db import models
from django.contrib.auth.models import User
3
from picampaign.campaign.models import Contact
Aymeric Barantal's avatar
Aymeric Barantal committed
4
5
6
7
8
9


class Organization(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64)
    sip_key = models.CharField(max_length=255)
Aymeric Barantal's avatar
Aymeric Barantal committed
10
    users = models.ManyToManyField(User, null=True, blank=True)
11
12
13

    def __unicode__(self):
        return self.name
14
15
16
17
18


class Group(models.Model):
    """Group model to qualify contacts"""
    id = models.AutoField(primary_key=True)
Aymeric Barantal's avatar
Aymeric Barantal committed
19
    organisation = models.ForeignKey(Organization)
20
21
22
    name = models.CharField(max_length=64)
    type = models.CharField(max_length=255, blank=True)
    media = models.CharField(max_length=255, blank=True)
23
24
    contacts = models.ManyToManyField(Contact, null=True, blank=True,
                                      related_name='groups')
25
26
27

    def __unicode__(self):
        return self.name
Aymeric Barantal's avatar
Aymeric Barantal committed
28
29
30
31
32
33
34
35


class FeedbackCategory(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64)

    def __unicode__(self):
        return self.name