add room to talks
This commit is contained in:
parent
74aa1b5bf4
commit
afbd20af82
|
@ -30,7 +30,7 @@ class TalkForm(forms.ModelForm):
|
|||
|
||||
class Meta:
|
||||
model = Talk
|
||||
fields = ['title', 'abstract', 'description', 'topics', 'track', 'notes', 'event', 'speakers', 'duration', 'start_date']
|
||||
fields = ['title', 'abstract', 'description', 'topics', 'track', 'notes', 'event', 'speakers', 'duration', 'start_date', 'room']
|
||||
widgets = {'topics': forms.CheckboxSelectMultiple(), 'speakers': Select2TagWidget()}
|
||||
help_texts = {
|
||||
'abstract': _('Should be less than 255 characters'),
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.1 on 2016-10-11 09:30
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('planning', '0003_room_label'),
|
||||
('proposals', '0017_talk_start_date'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='talk',
|
||||
name='room',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='planning.Room'),
|
||||
),
|
||||
]
|
|
@ -13,6 +13,7 @@ from autoslug import AutoSlugField
|
|||
|
||||
from accounts.models import Participation
|
||||
from ponyconf.utils import PonyConfModel, enum_to_choices
|
||||
from planning.models import Room
|
||||
|
||||
from .utils import query_sum
|
||||
|
||||
|
@ -114,6 +115,7 @@ class Talk(PonyConfModel):
|
|||
accepted = models.NullBooleanField(default=None)
|
||||
start_date = models.DateTimeField(null=True, default=None)
|
||||
duration = models.IntegerField(default=0, verbose_name=_('Duration (min)'))
|
||||
room = models.ForeignKey(Room, null=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ('title',)
|
||||
|
|
|
@ -155,6 +155,7 @@ def talk_edit(request, talk=None):
|
|||
form.fields.pop('track')
|
||||
form.fields.pop('duration')
|
||||
form.fields.pop('start_date')
|
||||
form.fields.pop('room')
|
||||
if not talk.is_moderable_by(request.user):
|
||||
form.fields['title'].disabled = True
|
||||
else:
|
||||
|
@ -163,6 +164,7 @@ def talk_edit(request, talk=None):
|
|||
form.fields.pop('track')
|
||||
form.fields.pop('duration')
|
||||
form.fields.pop('start_date')
|
||||
form.fields.pop('room')
|
||||
if request.method == 'POST' and form.is_valid():
|
||||
if hasattr(talk, 'id'):
|
||||
talk = form.save()
|
||||
|
|
Loading…
Reference in New Issue