forked from AFPy/PonyConf
parent
b605a85903
commit
bd8538e7e2
|
@ -125,4 +125,4 @@ class TopicForm(forms.ModelForm):
|
|||
return name
|
||||
|
||||
|
||||
ConferenceForm = modelform_factory(Conference, fields=['cfp', 'home'])
|
||||
ConferenceForm = modelform_factory(Conference, fields=['home'])
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-09-24 12:08
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('proposals', '0012_topic_track'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='conference',
|
||||
name='cfp',
|
||||
field=models.IntegerField(choices=[(0, 'Forthcoming (closed)'), (1, 'Open'), (2, 'Completed (closed)')], default=0),
|
||||
),
|
||||
]
|
|
@ -18,18 +18,8 @@ from .utils import query_sum
|
|||
|
||||
class Conference(models.Model):
|
||||
|
||||
CFP_FORTHCOMING = 0
|
||||
CFP_OPEN = 1
|
||||
CFP_COMPLETED = 2
|
||||
CFP_CHOICES = [
|
||||
(CFP_FORTHCOMING, _('Forthcoming (closed)')),
|
||||
(CFP_OPEN, _('Open')),
|
||||
(CFP_COMPLETED, _('Completed (closed)')),
|
||||
]
|
||||
|
||||
site = models.OneToOneField(Site, on_delete=models.CASCADE, related_name='conference')
|
||||
site = models.OneToOneField(Site, on_delete=models.CASCADE)
|
||||
home = models.TextField(blank=True, default="")
|
||||
cfp = models.IntegerField(choices=CFP_CHOICES, default=0, verbose_name=_('Call for Participation'))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.site)
|
||||
|
|
|
@ -2,38 +2,39 @@
|
|||
|
||||
{% load bootstrap3 staticfiles i18n %}
|
||||
|
||||
{% block admintab %} class="active"{% endblock %}
|
||||
{% block talktab %} class="active"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{% trans "Conference settings" %}</h1>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3>{% trans "Home page" %}</h3>
|
||||
<div class="panel-heading">
|
||||
<h3>{% trans "Home page" %}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form method="post" role="form">
|
||||
{% csrf_token %}
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active"><a href="#editor" role="tab" data-toggle="tab">Editor</a></li>
|
||||
<li><a href="#preview" role="tab" data-toggle="tab">Preview</a></li>
|
||||
<li><a href="https://daringfireball.net/projects/markdown/syntax" target="blank" role="tab">Syntaxe</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="editor" style="max-height: 220px; margin-bottom: 20px;">
|
||||
<div class="form-group">
|
||||
<textarea style="width: 100%; height: 220px;" id="markdown-content" name="home">{{ conference.home }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form method="post" role="form">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_field form.cfp %}
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active"><a href="#editor" role="tab" data-toggle="tab">Editor</a></li>
|
||||
<li><a href="#preview" role="tab" data-toggle="tab">Preview</a></li>
|
||||
<li><a href="https://daringfireball.net/projects/markdown/syntax" target="blank" role="tab">Syntaxe</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="editor" style="max-height: 220px; margin-bottom: 20px;">
|
||||
<div class="form-group">
|
||||
<textarea style="width: 100%; height: 220px;" id="markdown-content" name="home">{{ conference.home }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane well" id="preview" style="min-height: 220px; magin-bottom: 20px;">
|
||||
<div id="preview-content"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="tab-pane well" id="preview" style="min-height: 220px; magin-bottom: 20px;">
|
||||
<div id="preview-content"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-pencil"></span> Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -19,12 +19,6 @@
|
|||
{% endif %}
|
||||
|
||||
<br />
|
||||
{% if conf.cfp == conf.CFP_FORTHCOMING %}
|
||||
<em>{% trans "The Call for Participation is not yet open." %}</em>
|
||||
{% elif conf.cfp == conf.CFP_OPEN %}
|
||||
<a class="btn btn-success" href="{% url 'add-talk' %}">{% trans "Propose a talk" %}</a>
|
||||
{% elif conf.cfp == conf.CFP_COMPLETED %}
|
||||
<em>{% trans "The Call for Participation is completed." %}</em>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -17,7 +17,7 @@ from django.http import HttpResponse
|
|||
from accounts.models import Participation
|
||||
from accounts.mixins import OrgaRequiredMixin, StaffRequiredMixin
|
||||
from accounts.decorators import orga_required, staff_required
|
||||
from accounts.utils import is_orga, is_staff
|
||||
from accounts.utils import is_staff
|
||||
|
||||
from conversations.models import ConversationWithParticipant, ConversationAboutTalk, Message
|
||||
|
||||
|
@ -53,14 +53,12 @@ def conference(request):
|
|||
|
||||
@login_required
|
||||
def participate(request):
|
||||
site = get_current_site(request)
|
||||
talks = Talk.objects.filter(site=site)
|
||||
talks = Talk.objects.filter(site=get_current_site(request))
|
||||
my_talks = talks.filter(speakers=request.user)
|
||||
proposed_talks = talks.exclude(speakers=request.user).filter(proposer=request.user)
|
||||
return render(request, 'proposals/participate.html', {
|
||||
'my_talks': my_talks,
|
||||
'proposed_talks': proposed_talks,
|
||||
'conf': site.conference,
|
||||
})
|
||||
|
||||
@staff_required
|
||||
|
@ -137,24 +135,18 @@ def talk_list(request):
|
|||
|
||||
@login_required
|
||||
def talk_edit(request, talk=None):
|
||||
site = get_current_site(request)
|
||||
if talk: # edit existing talk
|
||||
talk = get_object_or_404(Talk, slug=talk, site=site)
|
||||
if talk:
|
||||
talk = get_object_or_404(Talk, slug=talk, site=get_current_site(request))
|
||||
if not talk.is_editable_by(request.user):
|
||||
raise PermissionDenied()
|
||||
else: # add new talk
|
||||
if site.conference.cfp != Conference.CFP_OPEN and not is_orga(request, request.user):
|
||||
raise PermissionDenied()
|
||||
form = TalkForm(request.POST or None, instance=talk, site=site)
|
||||
form = TalkForm(request.POST or None, instance=talk, site=get_current_site(request))
|
||||
if not is_staff(request, request.user):
|
||||
form.fields.pop('track')
|
||||
if talk:
|
||||
form.fields['title'].disabled = True
|
||||
form.fields['topics'].disabled = True
|
||||
if not talk.is_editable_by(request.user):
|
||||
form.fields.pop('track')
|
||||
else:
|
||||
form.fields['speakers'].initial = [request.user]
|
||||
if not is_orga(request, request.user):
|
||||
form.fields.pop('track')
|
||||
if request.method == 'POST' and form.is_valid():
|
||||
if hasattr(talk, 'id'):
|
||||
talk = form.save()
|
||||
|
|
Loading…
Reference in New Issue
Block a user