Introduce generic comments system
Replace reviewers and proposer notes by a set of comments that can be posted on a proposal.
This commit is contained in:
parent
f23100d2b2
commit
80f33dde89
@ -77,11 +77,6 @@ class Proposal(models.Model):
|
||||
"blueprint called 'accounting'. You can specify multiple "
|
||||
"links, separated by spaces. This field is optional.")
|
||||
status = models.CharField(max_length=1, choices=STATUSES)
|
||||
proposer_notes = models.TextField(blank=True,
|
||||
help_text="Notes from the proposer to the evaluation committee. "
|
||||
"Those notes will not appear in the public description. "
|
||||
"This field is optional.")
|
||||
reviewer_notes = models.TextField(blank=True)
|
||||
scheduled = models.BooleanField(default=False)
|
||||
last_modified = models.DateTimeField(auto_now=True)
|
||||
|
||||
@ -92,23 +87,38 @@ class Proposal(models.Model):
|
||||
return self.title
|
||||
|
||||
|
||||
class Comment(models.Model):
|
||||
proposal = models.ForeignKey(Proposal)
|
||||
posted_date = models.DateTimeField(auto_now=True)
|
||||
author = models.ForeignKey(User)
|
||||
content = models.TextField(verbose_name="Add your comment")
|
||||
|
||||
class Meta:
|
||||
ordering = ['posted_date']
|
||||
|
||||
|
||||
class CommentForm(ModelForm):
|
||||
class Meta:
|
||||
model = Comment
|
||||
exclude = ('proposal', 'posted_date', 'author')
|
||||
|
||||
|
||||
class ProposalForm(ModelForm):
|
||||
class Meta:
|
||||
model = Proposal
|
||||
exclude = ('proposer', 'reviewer_notes', 'status', 'scheduled')
|
||||
exclude = ('proposer', 'status', 'scheduled')
|
||||
|
||||
|
||||
class ProposalEditForm(ModelForm):
|
||||
class Meta:
|
||||
model = Proposal
|
||||
exclude = ('topic', 'proposer', 'reviewer_notes', 'status',
|
||||
'scheduled')
|
||||
exclude = ('topic', 'proposer', 'status', 'scheduled')
|
||||
|
||||
|
||||
class ProposalReviewForm(ModelForm):
|
||||
class Meta:
|
||||
model = Proposal
|
||||
fields = ('status', 'reviewer_notes')
|
||||
fields = ('status',)
|
||||
|
||||
|
||||
class ProposalSwitchForm(ModelForm):
|
||||
|
@ -1,9 +1,9 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "regform.html" %}
|
||||
{% block helppage %}
|
||||
<p>This screen lets you see the details of a proposed session.</p>
|
||||
<p>Note that you can only edit sessions that you suggested yourself (or if you're the topic lead). Sessions in <i>Preapproved</i> state cannot be changed.</p>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% block formtitle %}
|
||||
<h2>{{ proposal.title }}</h2>
|
||||
<p>Proposed by <b>{{ proposal.proposer }}</b>
|
||||
in topic <b>{{ proposal.topic }}</b></p>
|
||||
@ -29,4 +29,17 @@ Scheduled
|
||||
<a class=roundedButton href="/cfp/edit/{{ proposal.id }}">Edit</A>
|
||||
{% endif %}
|
||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Back</A>
|
||||
<h4>Comments</h4>
|
||||
<hr>
|
||||
{% for comment in comments %}
|
||||
<p>Comment by {{ comment.author }}
|
||||
on {{ comment.posted_date|date:"Y-m-d G:i O" }}:<br>
|
||||
{{ comment.content|linebreaks|urlize }}</p>
|
||||
<br><hr>
|
||||
{% endfor %}
|
||||
<form action="/cfp/details/{{ proposal.id }}" method="post">
|
||||
{% endblock %}
|
||||
{% block formfooter %}
|
||||
<input id="toggleButton" class="roundedButton" type="submit"
|
||||
value="Add comment" />
|
||||
{% endblock %}
|
||||
|
@ -5,10 +5,6 @@
|
||||
{% endblock %}
|
||||
{% block formtitle %}
|
||||
<h2>Edit proposed {{proposal.topic.name}} session</h2>
|
||||
{% if proposal.reviewer_notes %}
|
||||
<h4>Reviewer notes:</h4>
|
||||
<p>{{ proposal.reviewer_notes }}</p>
|
||||
{% endif %}
|
||||
<form action="/cfp/edit/{{ proposal.id }}" method="post">
|
||||
{% endblock %}
|
||||
{% block formfooter %}
|
||||
|
@ -28,8 +28,4 @@ in topic <b>{{ proposal.topic }}</b></p>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if proposal.proposer_notes %}
|
||||
<h4>Proposer notes:</h4>
|
||||
<p>{{ proposal.proposer_notes }}</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
21
cfp/views.py
21
cfp/views.py
@ -21,8 +21,8 @@ from django.contrib.auth import logout
|
||||
from django.core.mail import EmailMessage
|
||||
from django.http import HttpResponseRedirect, HttpResponseForbidden
|
||||
from django.utils.encoding import smart_str
|
||||
from odsreg.cfp.models import Proposal, Topic
|
||||
from odsreg.cfp.models import ProposalForm, ProposalEditForm
|
||||
from odsreg.cfp.models import Proposal, Topic, Comment
|
||||
from odsreg.cfp.models import ProposalForm, ProposalEditForm, CommentForm
|
||||
from odsreg.cfp.models import ProposalReviewForm, ProposalSwitchForm
|
||||
|
||||
|
||||
@ -98,8 +98,21 @@ def is_editable(proposal, user):
|
||||
@login_required
|
||||
def details(request, proposalid):
|
||||
proposal = Proposal.objects.get(id=proposalid)
|
||||
comments = Comment.objects.filter(proposal=proposal)
|
||||
if request.method == 'POST':
|
||||
form = CommentForm(request.POST)
|
||||
if form.is_valid():
|
||||
comment = form.save(commit=False)
|
||||
comment.proposal = proposal
|
||||
comment.author = request.user
|
||||
comment.save()
|
||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||
else:
|
||||
form = CommentForm()
|
||||
return render(request, "cfpdetails.html",
|
||||
{'proposal': proposal,
|
||||
'form': form,
|
||||
'comments': comments,
|
||||
'editable': is_editable(proposal, request.user),
|
||||
'blueprints': linkify(proposal.blueprints)})
|
||||
|
||||
@ -154,6 +167,8 @@ def switch(request, proposalid):
|
||||
@login_required
|
||||
def review(request, proposalid):
|
||||
proposal = Proposal.objects.get(id=proposalid)
|
||||
#TODO Allow comment while reviewing to be included in email
|
||||
reviewer_notes = ""
|
||||
if not topiclead(request.user, proposal.topic):
|
||||
return forbidden()
|
||||
current_status = proposal.status
|
||||
@ -180,7 +195,7 @@ You can edit your proposal at: %s/cfp/edit/%s""" \
|
||||
smart_str(proposal.title),
|
||||
proposal.topic.lead_username,
|
||||
status_long, proposal.get_status_display(),
|
||||
smart_str(proposal.reviewer_notes),
|
||||
smart_str(reviewer_notes),
|
||||
settings.SITE_ROOT, proposalid)
|
||||
email = EmailMessage(settings.EMAIL_PREFIX +
|
||||
"Status change on your session proposal",
|
||||
|
Loading…
Reference in New Issue
Block a user