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