WIP program app
This commit is contained in:
parent
add35068af
commit
99f79e0ca2
0
program/__init__.py
Normal file
0
program/__init__.py
Normal file
6
program/admin.py
Normal file
6
program/admin.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import Event, Speaker
|
||||||
|
|
||||||
|
admin.site.register(Event)
|
||||||
|
admin.site.register(Speaker)
|
7
program/apps.py
Normal file
7
program/apps.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ProgramConfig(AppConfig):
|
||||||
|
name = 'program'
|
63
program/migrations/0001_initial.py
Normal file
63
program/migrations/0001_initial.py
Normal file
|
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
0
program/migrations/__init__.py
Normal file
0
program/migrations/__init__.py
Normal file
29
program/models.py
Normal file
29
program/models.py
Normal file
|
@ -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')
|
3
program/tests.py
Normal file
3
program/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
6
program/urls.py
Normal file
6
program/urls.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.conf.urls import url
|
||||||
|
from views import *
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^$', ProgramIndexView.as_view(), name='index')
|
||||||
|
]
|
3
program/views.py
Normal file
3
program/views.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
Loading…
Reference in a new issue