models.py 1.41 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.contact.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)
10
11
    users = models.ManyToManyField(User, null=True, blank=True,
                                   related_name='organizations')
12
13
14

    def __unicode__(self):
        return self.name
15
16


17
18
19
20
21
22
23
24
25
class GroupType(models.Model):
    id = models.AutoField(primary_key=True)
    organization = models.ForeignKey(Organization)
    name = models.CharField(max_length=64)

    def __unicode__(self):
        return self.name


26
27
28
class Group(models.Model):
    """Group model to qualify contacts"""
    id = models.AutoField(primary_key=True)
Aymeric Barantal's avatar
Aymeric Barantal committed
29
    organization = models.ForeignKey(Organization)
30
    name = models.CharField(max_length=64)
31
    type = models.ForeignKey(GroupType, blank=True, null=True)
32
    media = models.CharField(max_length=255, blank=True)
33
34
    contacts = models.ManyToManyField(Contact, null=True, blank=True,
                                      related_name='groups')
35
36
37

    def __unicode__(self):
        return self.name
Aymeric Barantal's avatar
Aymeric Barantal committed
38
39
40
41
42


class FeedbackCategory(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64)
43
    organization = models.ForeignKey(Organization)
Aymeric Barantal's avatar
Aymeric Barantal committed
44
45
46

    def __unicode__(self):
        return self.name