Commit 639465b4 authored by Aymeric Barantal's avatar Aymeric Barantal

move contact model in a dedicated app

parent f994bfcb
from django.contrib import admin from django.contrib import admin
from picampaign.campaign.models import (Campaign, Contact, CampaignContact, from picampaign.campaign.models import (Campaign, CampaignContact,
Argumentary) Argumentary)
...@@ -12,6 +12,5 @@ class CampaignAdmin(admin.ModelAdmin): ...@@ -12,6 +12,5 @@ class CampaignAdmin(admin.ModelAdmin):
admin.site.register(Campaign, CampaignAdmin) admin.site.register(Campaign, CampaignAdmin)
admin.site.register(Contact)
admin.site.register(CampaignContact) admin.site.register(CampaignContact)
admin.site.register(Argumentary) admin.site.register(Argumentary)
...@@ -2,21 +2,11 @@ from django.db import models ...@@ -2,21 +2,11 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.conf import settings from django.conf import settings
from picampaign.organization.models import Organization
from picampaign.contact.models import Contact
LANGUAGES = map(lambda (k, v): (k, _(v)), settings.LANGUAGES)
class Contact(models.Model):
"""Contact model. Person to be called by users"""
id = models.AutoField(primary_key=True)
first_name = models.CharField(max_length=64)
last_name = models.CharField(max_length=64)
phone = models.CharField(max_length=32)
twitter = models.CharField(max_length=64, blank=True)
mail = models.CharField(max_length=255, blank=True)
def __unicode__(self): LANGUAGES = map(lambda (k, v): (k, _(v)), settings.LANGUAGES)
return '%s %s' % (self.first_name, self.last_name)
class Campaign(models.Model): class Campaign(models.Model):
...@@ -24,6 +14,7 @@ class Campaign(models.Model): ...@@ -24,6 +14,7 @@ class Campaign(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
title = models.CharField(max_length=255) title = models.CharField(max_length=255)
description = models.CharField(max_length=512, blank=True) description = models.CharField(max_length=512, blank=True)
organization = models.ForeignKey(Organization)
start_date = models.DateField() start_date = models.DateField()
end_date = models.DateField() end_date = models.DateField()
default_lang = models.CharField(max_length=5, default_lang = models.CharField(max_length=5,
......
from django.contrib import admin
from picampaign.contact.models import Contact
admin.site.register(Contact)
from django.db import models
class Contact(models.Model):
"""Contact model. Person to be called by users"""
id = models.AutoField(primary_key=True)
first_name = models.CharField(max_length=64)
last_name = models.CharField(max_length=64)
phone = models.CharField(max_length=32)
twitter = models.CharField(max_length=64, blank=True)
mail = models.CharField(max_length=255, blank=True)
def __unicode__(self):
return '%s %s' % (self.first_name, self.last_name)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from picampaign.campaign.models import Contact from picampaign.contact.models import Contact
class Organization(models.Model): class Organization(models.Model):
...@@ -30,6 +30,7 @@ class Group(models.Model): ...@@ -30,6 +30,7 @@ class Group(models.Model):
class FeedbackCategory(models.Model): class FeedbackCategory(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
name = models.CharField(max_length=64) name = models.CharField(max_length=64)
organization = models.ForeignKey(Organization)
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -37,6 +37,7 @@ INSTALLED_APPS = ( ...@@ -37,6 +37,7 @@ INSTALLED_APPS = (
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'rest_framework', 'rest_framework',
'picampaign.contact',
'picampaign.campaign', 'picampaign.campaign',
'picampaign.organization', 'picampaign.organization',
'picampaign.feedback', 'picampaign.feedback',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment