staff can add speakers to a talk
This commit is contained in:
parent
17e807b886
commit
0a8ec84b0b
15
cfp/forms.py
15
cfp/forms.py
|
@ -362,3 +362,18 @@ class VolunteerForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Volunteer
|
model = Volunteer
|
||||||
fields = ['name', 'email', 'phone_number', 'sms_prefered', 'notes']
|
fields = ['name', 'email', 'phone_number', 'sms_prefered', 'notes']
|
||||||
|
|
||||||
|
|
||||||
|
class ParticipantWidget(ModelSelect2MultipleWidget):
|
||||||
|
model = Participant
|
||||||
|
search_fields = [ '%s__icontains' % field for field in ['name', 'email', 'twitter', 'linkedin', 'github',
|
||||||
|
'website', 'facebook', 'mastodon', 'phone_number' ]]
|
||||||
|
|
||||||
|
|
||||||
|
class TalkSpeakerForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Talk
|
||||||
|
fields = ['speakers']
|
||||||
|
widgets = {
|
||||||
|
'speakers': ParticipantWidget(),
|
||||||
|
}
|
||||||
|
|
|
@ -78,6 +78,10 @@
|
||||||
<i>{% trans "No speakers." %}</i>
|
<i>{% trans "No speakers." %}</i>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% block talk_actions %}
|
||||||
|
<br />
|
||||||
|
<a href="{% url 'talk-speaker-add' talk_id=talk.pk %}" class="btn btn-xs btn-success">{% trans "Add a speaker" %}</a>
|
||||||
|
|
||||||
<h3>{% trans "Notes" %}</h3>
|
<h3>{% trans "Notes" %}</h3>
|
||||||
|
|
||||||
<p>{% if talk.notes %}{{ talk.notes|linebreaksbr }}{% else %}<i>{% trans "No notes." %}</i>{% endif %}</p>
|
<p>{% if talk.notes %}{{ talk.notes|linebreaksbr }}{% else %}<i>{% trans "No notes." %}</i>{% endif %}</p>
|
||||||
|
@ -128,3 +132,4 @@
|
||||||
{% include 'mailing/_message_form.html' %}
|
{% include 'mailing/_message_form.html' %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{% extends 'cfp/staff/talk_details.html' %}
|
||||||
|
{% load i18n crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block talk_actions %}
|
||||||
|
|
||||||
|
<h3>{% trans "Add a speaker" %}</h3>
|
||||||
|
|
||||||
|
|
||||||
|
<form method="POST">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<a href="{{ talk.get_absolute_url }}" class="btn btn-default">{% trans "Abort" %}</a>
|
||||||
|
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js_end %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ form.media.js }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ form.media.css }}
|
||||||
|
{% endblock %}
|
|
@ -35,7 +35,7 @@ urlpatterns = [
|
||||||
url(r'^staff/talks/(?P<talk_id>[0-9]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'),
|
url(r'^staff/talks/(?P<talk_id>[0-9]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'),
|
||||||
url(r'^staff/talks/(?P<talk_id>[0-9]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'),
|
url(r'^staff/talks/(?P<talk_id>[0-9]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'),
|
||||||
url(r'^staff/talks/(?P<talk_id>[0-9]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
|
url(r'^staff/talks/(?P<talk_id>[0-9]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
|
||||||
# url(r'^staff/talks/(?P<talk_id>[0-9]+)/speaker/add/$', views.talk_speaker_add, name='talk-speaker-add'), TODO WIP
|
url(r'^staff/talks/(?P<talk_id>[0-9]+)/speaker/add/$', views.talk_speaker_add, name='talk-speaker-add'),
|
||||||
url(r'^staff/talks/(?P<talk_id>[0-9]+)/speaker/remove/(?P<participant_id>[0-9]+)/$', views.talk_speaker_remove, name='talk-speaker-remove'),
|
url(r'^staff/talks/(?P<talk_id>[0-9]+)/speaker/remove/(?P<participant_id>[0-9]+)/$', views.talk_speaker_remove, name='talk-speaker-remove'),
|
||||||
url(r'^staff/speakers/$', views.participant_list, name='participant-list'),
|
url(r'^staff/speakers/$', views.participant_list, name='participant-list'),
|
||||||
url(r'^staff/speakers/add/$', views.ParticipantCreate.as_view(), name='participant-add'),
|
url(r'^staff/speakers/add/$', views.ParticipantCreate.as_view(), name='participant-add'),
|
||||||
|
|
18
cfp/views.py
18
cfp/views.py
|
@ -26,7 +26,7 @@ from .decorators import speaker_required, volunteer_required, staff_required
|
||||||
from .mixins import StaffRequiredMixin, OnSiteMixin, OnSiteFormMixin
|
from .mixins import StaffRequiredMixin, OnSiteMixin, OnSiteFormMixin
|
||||||
from .utils import is_staff
|
from .utils import is_staff
|
||||||
from .models import Participant, Talk, TalkCategory, Vote, Track, Tag, Room, Volunteer, Activity
|
from .models import Participant, Talk, TalkCategory, Vote, Track, Tag, Room, Volunteer, Activity
|
||||||
from .forms import TalkForm, TalkStaffForm, TalkFilterForm, TalkActionForm, \
|
from .forms import TalkForm, TalkStaffForm, TalkFilterForm, TalkActionForm, TalkSpeakerForm, \
|
||||||
ParticipantForm, ParticipantFilterForm, NotifyForm, \
|
ParticipantForm, ParticipantFilterForm, NotifyForm, \
|
||||||
ConferenceForm, HomepageForm, CreateUserForm, TrackForm, RoomForm, \
|
ConferenceForm, HomepageForm, CreateUserForm, TrackForm, RoomForm, \
|
||||||
VolunteerForm, VolunteerFilterForm, MailForm, \
|
VolunteerForm, VolunteerFilterForm, MailForm, \
|
||||||
|
@ -705,9 +705,19 @@ def talk_decide(request, talk_id, accept):
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
# @staff_required TODO WIP
|
@staff_required
|
||||||
# def talk_speaker_add(request, talk_id, participant_id=None):
|
def talk_speaker_add(request, talk_id):
|
||||||
# talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site)
|
talk = get_object_or_404(Talk, pk=talk_id, site=request.conference.site)
|
||||||
|
form = TalkSpeakerForm(request.POST or None, instance=talk)
|
||||||
|
if request.method == 'POST' and form.is_valid():
|
||||||
|
form.save()
|
||||||
|
messages.success(request, _('Decision taken in account'))
|
||||||
|
return redirect(talk.get_absolute_url())
|
||||||
|
return render(request, 'cfp/staff/talk_speaker_add.html', {
|
||||||
|
'talk': talk,
|
||||||
|
'form': form,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@staff_required
|
@staff_required
|
||||||
|
|
Loading…
Reference in New Issue