models.py 1.18 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


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

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


class FeedbackCategory(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64)
34
    organization = models.ForeignKey(Organization)
Aymeric Barantal's avatar
Aymeric Barantal committed
35
36
37

    def __unicode__(self):
        return self.name