models.py 848 Bytes
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 campaign.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.ForeignKey(User, null=True, blank=True)
11
12
13

    def __unicode__(self):
        return self.name
14
15
16
17
18
19
20
21
22


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, blank=True)
    media = models.CharField(max_length=255, blank=True)
Aymeric Barantal's avatar
Aymeric Barantal committed
23
    contacts = models.ManyToManyField(Contact, null=True, blank=True)
24
25
26

    def __unicode__(self):
        return self.name