From 5c00934027c7fdab99d04a943a1f021e31765167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Wed, 13 Jul 2016 21:44:09 +0200 Subject: [PATCH] Resolve merge conflict. --- bornhack/settings/base.py | 1 + camps/models.py | 6 ++++++ program/admin.py | 20 +++++++++++++++++--- program/migrations/0001_initial.py | 8 ++++++-- program/models.py | 20 ++++++++++++-------- program/views.py | 1 - 6 files changed, 42 insertions(+), 14 deletions(-) diff --git a/bornhack/settings/base.py b/bornhack/settings/base.py index 269257f9..3505ecfc 100644 --- a/bornhack/settings/base.py +++ b/bornhack/settings/base.py @@ -30,6 +30,7 @@ INSTALLED_APPS = [ 'news', 'utils', 'villages', + 'program', 'allauth', 'allauth.account', diff --git a/camps/models.py b/camps/models.py index 881d225f..ea38b8c2 100644 --- a/camps/models.py +++ b/camps/models.py @@ -73,6 +73,12 @@ class Day(CreatedUpdatedModel, UUIDModel): help_text=_('What date?') ) + def __str__(self): + return '{} {}'.format( + self.date, + self.camp + ) + class Expense(CreatedUpdatedModel, UUIDModel): class Meta: diff --git a/program/admin.py b/program/admin.py index abaaceda..16c4604d 100644 --- a/program/admin.py +++ b/program/admin.py @@ -1,6 +1,20 @@ from django.contrib import admin -from .models import Event, Speaker +from .models import Event, Speaker, EventType + + +@admin.register(EventType) +class EventTypeAdmin(admin.ModelAdmin): + pass + + +@admin.register(Event) +class EventAdmin(admin.ModelAdmin): + pass + + +@admin.register(Speaker) +class SpeakerAdmin(admin.ModelAdmin): + pass + -admin.site.register(Event) -admin.site.register(Speaker) diff --git a/program/migrations/0001_initial.py b/program/migrations/0001_initial.py index 9aefd2fd..ade6047f 100644 --- a/program/migrations/0001_initial.py +++ b/program/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-03 17:17 +# Generated by Django 1.9.6 on 2016-07-13 19:38 from __future__ import unicode_literals from django.db import migrations, models @@ -11,6 +11,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('camps', '0005_auto_20160510_2011'), ] operations = [ @@ -22,6 +23,9 @@ class Migration(migrations.Migration): ('updated', models.DateTimeField(auto_now=True)), ('title', models.CharField(max_length=255)), ('description', models.TextField()), + ('start', models.TimeField()), + ('end', models.TimeField()), + ('days', models.ManyToManyField(to='camps.Day')), ], options={ 'abstract': False, @@ -48,7 +52,7 @@ class Migration(migrations.Migration): ('updated', models.DateTimeField(auto_now=True)), ('name', models.CharField(max_length=150)), ('biography', models.TextField()), - ('picture', models.ImageField(upload_to=b'')), + ('picture', models.ImageField(blank=True, null=True, upload_to=b'')), ('events', models.ManyToManyField(related_name='speakers', related_query_name='speaker', to='program.Event')), ], options={ diff --git a/program/models.py b/program/models.py index 09f765fc..6a9acbe6 100644 --- a/program/models.py +++ b/program/models.py @@ -1,29 +1,33 @@ -"""Model definitions for the program app.""" from __future__ import unicode_literals from django.db import models +from django.contrib.postgres.fields import DateTimeRangeField from utils.models import CreatedUpdatedModel class EventType(CreatedUpdatedModel): - '''Every event needs to have a type.''' + """ 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.''' + """ Something that is on the program. """ title = models.CharField(max_length=255) description = models.TextField() - event_type = models.ForeignKey( - EventType) + event_type = models.ForeignKey(EventType) + days = models.ManyToManyField('camps.Day') + start = models.TimeField() + end = models.TimeField() + class Speaker(CreatedUpdatedModel): - '''Person anchoring an event.''' + """ Person anchoring an event. """ name = models.CharField(max_length=150) biography = models.TextField() - picture = models.ImageField() + picture = models.ImageField(null=True, blank=True) events = models.ManyToManyField( Event, related_name='speakers', - related_query_name='speaker') + related_query_name='speaker' + ) diff --git a/program/views.py b/program/views.py index 91ea44a2..28002783 100644 --- a/program/views.py +++ b/program/views.py @@ -1,3 +1,2 @@ from django.shortcuts import render -# Create your views here.