Commit ac858174 authored by Aymeric Barantal's avatar Aymeric Barantal

first version of data model

parent 12e5eb05
from django.contrib import admin
from campaign.campaign.models import (Campaign, Contact, CampaignContact,
Group, Argumentary)
admin.site.register(Campaign)
admin.site.register(Contact)
admin.site.register(CampaignContact)
admin.site.register(Group)
admin.site.register(Argumentary)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('organization', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Argumentary',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('lang', models.CharField(max_length=255)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Campaign',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('title', models.CharField(max_length=255)),
('description', models.CharField(max_length=512)),
('start_date', models.DateTimeField()),
('end_date', models.DateTimeField()),
('default_lang', models.CharField(max_length=5)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='CampaignContact',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('weight', models.IntegerField(default=0)),
('campaign_id', models.ForeignKey(to='campaign.Campaign')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Contact',
fields=[
('id', models.AutoField(serialize=False, 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)),
('mail', models.CharField(max_length=255)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Group',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('name', models.CharField(max_length=64)),
('type', models.CharField(max_length=255)),
('media', models.CharField(max_length=255)),
('contacts', models.ManyToManyField(to='campaign.Contact')),
('organisation_id', models.ForeignKey(to='organization.Organization')),
],
options={
},
bases=(models.Model,),
),
migrations.AddField(
model_name='campaigncontact',
name='contact_id',
field=models.ForeignKey(to='campaign.Contact'),
preserve_default=True,
),
migrations.AddField(
model_name='argumentary',
name='campaign_id',
field=models.ForeignKey(to='campaign.Campaign'),
preserve_default=True,
),
]
from django.db import models
from campaign.organization.models import Organization
class Contact(models.Model):
"""Contact model. Person to be call 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)
mail = models.CharField(max_length=255)
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)
media = models.CharField(max_length=255)
contacts = models.ManyToManyField(Contact)
class Campaign(models.Model):
"""Campaign model, describe what have to be achieved"""
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=255)
description = models.CharField(max_length=512)
start_date = models.DateTimeField()
end_date = models.DateTimeField()
default_lang = models.CharField(max_length=5)
class Argumentary(models.Model):
id = models.AutoField(primary_key=True)
campaign_id = models.ForeignKey(Campaign)
lang = models.CharField(max_length=255)
class CampaignContact(models.Model):
"""List contact related to a campaign with a given weight"""
id = models.AutoField(primary_key=True)
campaign_id = models.ForeignKey(Campaign)
contact_id = models.ForeignKey(Contact)
weight = models.IntegerField(default=0)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
from django.contrib import admin
from campaign.organization.models import Organization
admin.site.register(Organization)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Organization',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('name', models.CharField(max_length=64)),
('sip_key', models.CharField(max_length=255)),
('users', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
},
bases=(models.Model,),
),
]
from django.db import models
from django.contrib.auth.models import User
class Organization(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=64)
sip_key = models.CharField(max_length=255)
users = models.ForeignKey(User)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
"""
Django settings for campaign project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@q8%6uzh(bku)zmkl$&*_8m3(!f^rpw+d=&zi7llu=fjps!f_x'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'campaign.campaign',
'campaign.organization',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'campaign.urls'
WSGI_APPLICATION = 'campaign.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'campaign.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
"""
WSGI config for campaign project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "campaign.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "campaign.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
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