Use same link for view/edit proposals

URLs for viewing and editing proposals were different, which caused
confusion when people posted links to their proposals.

Additionally fix a few places where "Scheduled" status was not migrated
from proposal.status = 'S' to proposal.scheduled = True.
This commit is contained in:
Thierry Carrez 2013-05-24 17:02:56 +02:00
parent e8be655488
commit 7fb28f40e6
6 changed files with 16 additions and 25 deletions

View File

@ -18,6 +18,12 @@ in topic <b>{{ proposal.topic }}</b></p>
</ul>
{% endif %}
<h4>Status</h4>
<p>This proposal is in <b>{{ proposal.get_status_display }}</b> state.</p>
<p>This proposal is in <b>
{% if proposal.scheduled %}
Scheduled
{% else %}
{{ proposal.get_status_display }}
{% endif %}
</b> state.</p>
<a class=roundedButton href="/{{ request.session.lastlist }}">Back</A>
{% endblock %}

View File

@ -9,7 +9,7 @@
<h4>Reviewer notes:</h4>
<p>{{ proposal.reviewer_notes }}</p>
{% endif %}
<form action="/cfp/edit/{{ proposal.id }}" method="post">
<form action="/cfp/details/{{ proposal.id }}" method="post">
{% endblock %}
{% block formfooter %}
<input id="toggleButton" class="roundedButton" type="submit" value="Modify" />

View File

@ -31,12 +31,7 @@
<tr>
<td>{{ proposal.topic.name }}</td>
<td>
{% if proposal.proposer == user and proposal.status != 'A' %}
<a href="/cfp/edit/{{ proposal.id }}">
{% else %}
<a href="/cfp/details/{{ proposal.id }}">
{% endif %}
{{ proposal.title }}</a>
<a href="/cfp/details/{{ proposal.id }}">{{ proposal.title }}</a>
</td>
<td>{{ proposal.proposer.first_name }} {{ proposal.proposer.last_name }}</td>
<td class="right"><span class="sortkey">{{ proposal.status }}</span>

View File

@ -39,11 +39,7 @@
{% endif %}
</td>
<td>
{% if proposal.scheduled %}
<a href="/cfp/details/{{ proposal.id }}">{{ proposal.title }}</a>
{% else %}
<a href="/cfp/edit/{{ proposal.id }}">{{ proposal.title }}</a>
{% endif %}
</td>
<td>{{ proposal.proposer.first_name }} {{ proposal.proposer.last_name }}</td>
<td class="right"><span class="sortkey">{{ proposal.status }}</span>

View File

@ -19,7 +19,6 @@ from django.conf.urls.defaults import *
urlpatterns = patterns('odsreg.cfp.views',
(r'^details/(\d+)$', 'details'),
(r'^create$', 'create'),
(r'^edit/(\d+)$', 'edit'),
(r'^review/(\d+)$', 'review'),
(r'^switch/(\d+)$', 'switch'),
(r'^delete/(\d+)$', 'delete'),

View File

@ -72,14 +72,6 @@ def topicstatus(request):
return render(request, "topicstatus.html", {'topics': topics})
@login_required
def details(request, proposalid):
proposal = Proposal.objects.get(id=proposalid)
return render(request, "cfpdetails.html",
{'proposal': proposal,
'blueprints': linkify(proposal.blueprints)})
@login_required
def create(request):
if request.method == 'POST':
@ -98,11 +90,14 @@ def create(request):
@login_required
def edit(request, proposalid):
def details(request, proposalid):
proposal = Proposal.objects.get(id=proposalid)
if (((proposal.proposer != request.user) or proposal.status in ['A', 'S'])
and not topiclead(request.user, proposal.topic)):
return forbidden()
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,
'blueprints': linkify(proposal.blueprints)})
if request.method == 'POST':
form = ProposalEditForm(request.POST, instance=proposal)
if form.is_valid():