add speaker & talk from staff area
This commit is contained in:
parent
93a31c5e08
commit
69f647c05d
|
@ -7,8 +7,8 @@
|
|||
{{ block.super }}
|
||||
<div class="container">
|
||||
<ul class="nav nav-pills nav-justified subnav">
|
||||
<li{% block talkstab %}{% endblock %}><a href="{% url 'talk-list' %}"><span class="glyphicon glyphicon-blackboard"></span> {% trans "Talks" %}</a></li>
|
||||
<li{% block speakerstab %}{% endblock %}><a href="{% url 'participant-list' %}"><span class="glyphicon glyphicon-bullhorn"></span> {% trans "Speakers" %}</a></li>
|
||||
<li{% block talkstab %}{% endblock %}><a href="{% url 'talk-list' %}"><span class="glyphicon glyphicon-blackboard"></span> {% trans "Talks" %}</a></li>
|
||||
<li{% block volunteersstafftab %}{% endblock %}><a href="{% url 'volunteer-list' %}"><span class="glyphicon glyphicon-thumbs-up"></span> {% trans "Volunteers" %}</a></li>
|
||||
<li{% block trackstab %}{% endblock %}><a href="{% url 'track-list' %}"><span class="glyphicon glyphicon-screenshot"></span> {% trans "Tracks" %}</a></li>
|
||||
<li{% block roomstab %}{% endblock %}><a href="{% url 'room-list' %}"><span class="glyphicon glyphicon-tent"></span> {% trans "Rooms" %}</a></li>
|
||||
|
|
|
@ -54,8 +54,12 @@
|
|||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% empty %}{% trans "No talks" %}
|
||||
{% empty %}
|
||||
<p>{% trans "No talks" %}</p>
|
||||
{% endfor %}
|
||||
<p>
|
||||
<a class="btn btn-success" href="{% url 'participant-add-talk' participant.pk %}">{% trans "Add a talk" %}</a>
|
||||
</p>
|
||||
|
||||
<h2>{% trans "Messaging" %}</h2>
|
||||
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<h1>{% trans "Edit a speaker" %}</h1>
|
||||
<h1>
|
||||
{% if participant %}
|
||||
{% trans "Edit a speaker" %}
|
||||
{% else %}
|
||||
{% trans "Add a speaker" %}
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{% url 'participant-details' participant.token as cancel_url %}
|
||||
{% include '_form.html' %}
|
||||
|
|
|
@ -7,7 +7,14 @@
|
|||
|
||||
<h1>{% trans "Speakers" %}</h1>
|
||||
|
||||
<p><a class="btn btn-primary" role="button" data-toggle="collapse" href="#filter" aria-expanded="{{ show_filters|yesno:"true,false" }}" aria-controles="filter">{% trans "Show filtering options…" %}</a></p>
|
||||
<p>
|
||||
<a class="btn btn-primary" role="button" data-toggle="collapse" href="#filter" aria-expanded="{{ show_filters|yesno:"true,false" }}" aria-controles="filter">
|
||||
{% bootstrap_icon "filter" %} {% trans "Show filtering options…" %}
|
||||
</a>
|
||||
<a class="btn btn-success" role="button" href="{% url 'participant-add' %}">
|
||||
{% bootstrap_icon "plus" %} {% trans "Add a speaker" %}
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div class="collapse{{ show_filters|yesno:" in," }}" id="filter">
|
||||
<div class="well">
|
||||
|
|
|
@ -5,9 +5,16 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<h1>{% trans "Edit a talk" %}</h1>
|
||||
<h1>
|
||||
{% if talk %}
|
||||
{% trans "Edit a talk" %}
|
||||
{% url 'talk-details' talk.token as cancel_url %}
|
||||
{% else %}
|
||||
{% trans "Add a talk" %}
|
||||
{% url 'participant-details' participant.token as cancel_url %}
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{% url 'talk-details' talk.token as cancel_url %}
|
||||
{% include '_form.html' with multipart=True %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -43,7 +43,9 @@ urlpatterns = [
|
|||
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'),
|
||||
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
|
||||
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/(?P<participant_id>[\w\-]+)/$', views.participant_details, name='participant-details'),
|
||||
url(r'^staff/speakers/(?P<participant_id>[\w\-]+)/add-talk/$', views.participant_add_talk, name='participant-add-talk'),
|
||||
url(r'^staff/speakers/(?P<participant_id>[\w\-]+)/edit/$', views.ParticipantUpdate.as_view(), name='participant-edit'),
|
||||
url(r'^staff/tracks/$', views.TrackList.as_view(), name='track-list'),
|
||||
url(r'^staff/tracks/add/$', views.TrackCreate.as_view(), name='track-add'),
|
||||
|
|
29
cfp/views.py
29
cfp/views.py
|
@ -755,6 +755,21 @@ def participant_details(request, participant_id):
|
|||
})
|
||||
|
||||
|
||||
class ParticipantCreate(StaffRequiredMixin, OnSiteFormMixin, CreateView):
|
||||
model = Participant
|
||||
slug_field = 'token'
|
||||
slug_url_kwarg = 'participant_id'
|
||||
#form_class = ParticipantStaffForm
|
||||
template_name = 'cfp/staff/participant_form.html'
|
||||
|
||||
def get_form_class(self):
|
||||
return modelform_factory(
|
||||
self.model,
|
||||
form=ParticipantForm,
|
||||
fields=['name', 'vip', 'email', 'phone_number', 'notes'] + ParticipantForm.SOCIAL_FIELDS,
|
||||
)
|
||||
|
||||
|
||||
class ParticipantUpdate(StaffRequiredMixin, OnSiteFormMixin, UpdateView):
|
||||
model = Participant
|
||||
slug_field = 'token'
|
||||
|
@ -770,6 +785,20 @@ class ParticipantUpdate(StaffRequiredMixin, OnSiteFormMixin, UpdateView):
|
|||
)
|
||||
|
||||
|
||||
@staff_required
|
||||
def participant_add_talk(request, participant_id):
|
||||
participant = get_object_or_404(Participant, site=request.conference.site, pk=participant_id)
|
||||
form = TalkForm(request.POST or None, categories=TalkCategory.objects.filter(site=request.conference.site))
|
||||
if request.method == 'POST' and form.is_valid():
|
||||
talk = form.save()
|
||||
talk.speakers.add(participant)
|
||||
return redirect(reverse('talk-details', kwargs=dict(talk_id=talk.token)))
|
||||
return render(request, 'cfp/staff/talk_form.html', {
|
||||
'form': form,
|
||||
'participant': participant,
|
||||
})
|
||||
|
||||
|
||||
@staff_required
|
||||
def conference_edit(request):
|
||||
form = ConferenceForm(request.POST or None, instance=request.conference)
|
||||
|
|
Loading…
Reference in New Issue