long or short conferences

This commit is contained in:
Guilhem Saurel 2016-06-25 12:36:57 +02:00
parent c0629d5a54
commit da95523877
3 changed files with 23 additions and 3 deletions

View File

@ -2,7 +2,7 @@ from django.contrib.sites.shortcuts import get_current_site
def enum_to_choices(enum):
return ((item.value, item.name) for item in list(enum))
return ((item.value, item.name.replace('_', ' ')) for item in list(enum))
def full_link(obj, request=None):

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-25 10:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0002_topic_reviewers'),
]
operations = [
migrations.AlterField(
model_name='talk',
name='event',
field=models.IntegerField(choices=[(1, 'conference short'), (2, 'conference long'), (3, 'workshop'), (4, 'stand'), (5, 'other')], default=1),
),
]

View File

@ -30,7 +30,7 @@ class Topic(models.Model):
class Talk(models.Model):
EVENTS = IntEnum('Event', 'conference workshop stand other')
EVENTS = IntEnum('Event', 'conference_short conference_long workshop stand other')
site = models.ForeignKey(Site, on_delete=models.CASCADE)
@ -40,7 +40,7 @@ class Talk(models.Model):
slug = AutoSlugField(populate_from='title', unique=True)
description = models.TextField(blank=True, verbose_name='Description')
topics = models.ManyToManyField(Topic, blank=True)
event = models.IntegerField(choices=enum_to_choices(EVENTS), default=EVENTS.conference.value)
event = models.IntegerField(choices=enum_to_choices(EVENTS), default=EVENTS.conference_short.value)
objects = models.Manager()
on_site = CurrentSiteManager()