Separate edition from viewing
This commit is contained in:
parent
7fb28f40e6
commit
f23100d2b2
@ -25,5 +25,8 @@ Scheduled
|
|||||||
{{ proposal.get_status_display }}
|
{{ proposal.get_status_display }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</b> state.</p>
|
</b> state.</p>
|
||||||
|
{% if editable %}
|
||||||
|
<a class=roundedButton href="/cfp/edit/{{ proposal.id }}">Edit</A>
|
||||||
|
{% endif %}
|
||||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Back</A>
|
<a class=roundedButton href="/{{ request.session.lastlist }}">Back</A>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<h4>Reviewer notes:</h4>
|
<h4>Reviewer notes:</h4>
|
||||||
<p>{{ proposal.reviewer_notes }}</p>
|
<p>{{ proposal.reviewer_notes }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form action="/cfp/details/{{ proposal.id }}" method="post">
|
<form action="/cfp/edit/{{ proposal.id }}" method="post">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block formfooter %}
|
{% block formfooter %}
|
||||||
<input id="toggleButton" class="roundedButton" type="submit" value="Modify" />
|
<input id="toggleButton" class="roundedButton" type="submit" value="Modify" />
|
||||||
|
@ -18,6 +18,7 @@ from django.conf.urls.defaults import *
|
|||||||
|
|
||||||
urlpatterns = patterns('odsreg.cfp.views',
|
urlpatterns = patterns('odsreg.cfp.views',
|
||||||
(r'^details/(\d+)$', 'details'),
|
(r'^details/(\d+)$', 'details'),
|
||||||
|
(r'^edit/(\d+)$', 'edit'),
|
||||||
(r'^create$', 'create'),
|
(r'^create$', 'create'),
|
||||||
(r'^review/(\d+)$', 'review'),
|
(r'^review/(\d+)$', 'review'),
|
||||||
(r'^switch/(\d+)$', 'switch'),
|
(r'^switch/(\d+)$', 'switch'),
|
||||||
|
23
cfp/views.py
23
cfp/views.py
@ -89,15 +89,26 @@ def create(request):
|
|||||||
return render(request, 'cfpcreate.html', {'topics': topics, 'form': form})
|
return render(request, 'cfpcreate.html', {'topics': topics, 'form': form})
|
||||||
|
|
||||||
|
|
||||||
|
def is_editable(proposal, user):
|
||||||
|
return ((not proposal.scheduled) and
|
||||||
|
((proposal.proposer == user and proposal.status != 'A') or
|
||||||
|
topiclead(user, proposal.topic)))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def details(request, proposalid):
|
def details(request, proposalid):
|
||||||
proposal = Proposal.objects.get(id=proposalid)
|
proposal = Proposal.objects.get(id=proposalid)
|
||||||
if (proposal.scheduled or
|
return render(request, "cfpdetails.html",
|
||||||
(((proposal.proposer != request.user) or proposal.status == 'A')
|
{'proposal': proposal,
|
||||||
and not topiclead(request.user, proposal.topic))):
|
'editable': is_editable(proposal, request.user),
|
||||||
return render(request, "cfpdetails.html",
|
'blueprints': linkify(proposal.blueprints)})
|
||||||
{'proposal': proposal,
|
|
||||||
'blueprints': linkify(proposal.blueprints)})
|
|
||||||
|
@login_required
|
||||||
|
def edit(request, proposalid):
|
||||||
|
proposal = Proposal.objects.get(id=proposalid)
|
||||||
|
if not is_editable(proposal, request.user):
|
||||||
|
return forbidden()
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = ProposalEditForm(request.POST, instance=proposal)
|
form = ProposalEditForm(request.POST, instance=proposal)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
Loading…
Reference in New Issue
Block a user