models.py 1.57 KB
Newer Older
1 2
from django.db import models
from django.contrib.auth.models import User
okhin's avatar
okhin committed
3 4
from ckeditor.fields import RichTextField

5
from picampaign.contact.models import Contact
6 7 8 9 10 11


class Organization(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64)
    sip_key = models.CharField(max_length=255)
12
    users = models.ManyToManyField(User, blank=True,
13
                                   related_name='organizations')
okhin's avatar
okhin committed
14
    description = RichTextField(blank=True)
15
    logo = models.ImageField(upload_to='organization/logos/', blank=True)
16
    website = models.URLField(blank=True)
17

18
    def __str__(self):
19
        return self.name
20 21


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

27
    def __str__(self):
28 29 30
        return self.name


31 32 33
class Group(models.Model):
    """Group model to qualify contacts"""
    id = models.AutoField(primary_key=True)
34
    #organization = models.ForeignKey(Organization)
35
    name = models.CharField(max_length=64)
36
    type = models.ForeignKey(GroupType, blank=True, null=True)
37
    media = models.CharField(max_length=255, blank=True)
38
    contacts = models.ManyToManyField(Contact, blank=True,
39
                                      related_name='groups')
40

41
    def __str__(self):
42
        return self.name
43 44 45 46 47


class FeedbackCategory(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64)
48
    organization = models.ForeignKey(Organization)
49

50
    def __str__(self):
51
        return self.name