From 99f79e0ca2f040f8e1fe3a9032bbf73db7bf8a88 Mon Sep 17 00:00:00 2001 From: Ronni Elken Lindsgaard Date: Wed, 13 Jul 2016 19:13:47 +0200 Subject: [PATCH] WIP program app --- program/__init__.py | 0 program/admin.py | 6 +++ program/apps.py | 7 ++++ program/migrations/0001_initial.py | 63 ++++++++++++++++++++++++++++++ program/migrations/__init__.py | 0 program/models.py | 29 ++++++++++++++ program/tests.py | 3 ++ program/urls.py | 6 +++ program/views.py | 3 ++ 9 files changed, 117 insertions(+) create mode 100644 program/__init__.py create mode 100644 program/admin.py create mode 100644 program/apps.py create mode 100644 program/migrations/0001_initial.py create mode 100644 program/migrations/__init__.py create mode 100644 program/models.py create mode 100644 program/tests.py create mode 100644 program/urls.py create mode 100644 program/views.py diff --git a/program/__init__.py b/program/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/program/admin.py b/program/admin.py new file mode 100644 index 00000000..abaaceda --- /dev/null +++ b/program/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin + +from .models import Event, Speaker + +admin.site.register(Event) +admin.site.register(Speaker) diff --git a/program/apps.py b/program/apps.py new file mode 100644 index 00000000..42b3e8ae --- /dev/null +++ b/program/apps.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class ProgramConfig(AppConfig): + name = 'program' diff --git a/program/migrations/0001_initial.py b/program/migrations/0001_initial.py new file mode 100644 index 00000000..9aefd2fd --- /dev/null +++ b/program/migrations/0001_initial.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-03 17:17 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Event', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('title', models.CharField(max_length=255)), + ('description', models.TextField()), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='EventType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('name', models.CharField(max_length=100)), + ('slug', models.SlugField()), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Speaker', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('name', models.CharField(max_length=150)), + ('biography', models.TextField()), + ('picture', models.ImageField(upload_to=b'')), + ('events', models.ManyToManyField(related_name='speakers', related_query_name='speaker', to='program.Event')), + ], + options={ + 'abstract': False, + }, + ), + migrations.AddField( + model_name='event', + name='event_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='program.EventType'), + ), + ] diff --git a/program/migrations/__init__.py b/program/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/program/models.py b/program/models.py new file mode 100644 index 00000000..09f765fc --- /dev/null +++ b/program/models.py @@ -0,0 +1,29 @@ +"""Model definitions for the program app.""" +from __future__ import unicode_literals + +from django.db import models +from utils.models import CreatedUpdatedModel + + +class EventType(CreatedUpdatedModel): + '''Every event needs to have a type.''' + name = models.CharField(max_length=100) + slug = models.SlugField() + + +class Event(CreatedUpdatedModel): + '''Something that is on the program.''' + title = models.CharField(max_length=255) + description = models.TextField() + event_type = models.ForeignKey( + EventType) + +class Speaker(CreatedUpdatedModel): + '''Person anchoring an event.''' + name = models.CharField(max_length=150) + biography = models.TextField() + picture = models.ImageField() + events = models.ManyToManyField( + Event, + related_name='speakers', + related_query_name='speaker') diff --git a/program/tests.py b/program/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/program/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/program/urls.py b/program/urls.py new file mode 100644 index 00000000..a185476a --- /dev/null +++ b/program/urls.py @@ -0,0 +1,6 @@ +from django.conf.urls import url +from views import * + +urlpatterns = [ + url(r'^$', ProgramIndexView.as_view(), name='index') +] diff --git a/program/views.py b/program/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/program/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.