tags: batch assignment
This commit is contained in:
parent
4e7ae4eca9
commit
28ed595924
|
@ -142,6 +142,7 @@ class TalkActionForm(forms.Form):
|
|||
talks = forms.MultipleChoiceField(choices=[])
|
||||
decision = forms.NullBooleanField(label=_('Accept talk?'))
|
||||
track = forms.ChoiceField(required=False, choices=[], label=_('Assign to a track'))
|
||||
tag = forms.ChoiceField(required=False, choices=[], label=_('Add a tag'))
|
||||
room = forms.ChoiceField(required=False, choices=[], label=_('Put in a room'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -151,6 +152,8 @@ class TalkActionForm(forms.Form):
|
|||
self.fields['talks'].choices = [(talk.token, None) for talk in talks.all()]
|
||||
tracks = Track.objects.filter(site=site)
|
||||
self.fields['track'].choices = [(None, "---------")] + list(tracks.values_list('slug', 'name'))
|
||||
tags = Tag.objects.filter(site=site)
|
||||
self.fields['tag'].choices = [(None, "---------")] + list(tags.values_list('slug', 'name'))
|
||||
rooms = Room.objects.filter(site=site)
|
||||
self.fields['room'].choices = [(None, "---------")] + list(rooms.values_list('slug', 'name'))
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ from .planning import Program
|
|||
from .decorators import staff_required
|
||||
from .mixins import StaffRequiredMixin, OnSiteMixin, OnSiteFormMixin
|
||||
from .utils import is_staff
|
||||
from .models import Participant, Talk, TalkCategory, Vote, Track, Room, Volunteer, Activity
|
||||
from .models import Participant, Talk, TalkCategory, Vote, Track, Tag, Room, Volunteer, Activity
|
||||
from .forms import TalkForm, TalkStaffForm, TalkFilterForm, TalkActionForm, \
|
||||
ParticipantForm, ParticipantStaffForm, ParticipantFilterForm, \
|
||||
ConferenceForm, CreateUserForm, TrackForm, RoomForm, VolunteerForm, \
|
||||
|
@ -289,6 +289,8 @@ def talk_list(request):
|
|||
talk.accepted = data['decision']
|
||||
if data['track']:
|
||||
talk.track = Track.objects.get(site=request.conference.site, slug=data['track'])
|
||||
if data['tag']:
|
||||
talk.tags.add(Tag.objects.get(site=request.conference.site, slug=data['tag']))
|
||||
if data['room']:
|
||||
talk.room = Room.objects.get(site=request.conference.site, slug=data['room'])
|
||||
talk.save()
|
||||
|
|
Loading…
Reference in New Issue