diff --git a/cfp/models.py b/cfp/models.py index 20f6ed4..7621a5a 100644 --- a/cfp/models.py +++ b/cfp/models.py @@ -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): diff --git a/cfp/templates/cfpdetails.html b/cfp/templates/cfpdetails.html index 822d130..6b3ffc9 100644 --- a/cfp/templates/cfpdetails.html +++ b/cfp/templates/cfpdetails.html @@ -1,9 +1,9 @@ -{% extends "base.html" %} +{% extends "regform.html" %} {% block helppage %}

This screen lets you see the details of a proposed session.

Note that you can only edit sessions that you suggested yourself (or if you're the topic lead). Sessions in Preapproved state cannot be changed.

{% endblock %} -{% block content %} +{% block formtitle %}

{{ proposal.title }}

Proposed by {{ proposal.proposer }} in topic {{ proposal.topic }}

@@ -29,4 +29,17 @@ Scheduled Edit {% endif %} Back +

Comments

+
+{% for comment in comments %} +

Comment by {{ comment.author }} +on {{ comment.posted_date|date:"Y-m-d G:i O" }}:
+{{ comment.content|linebreaks|urlize }}

+

+{% endfor %} +
+{% endblock %} +{% block formfooter %} + {% endblock %} diff --git a/cfp/templates/cfpedit.html b/cfp/templates/cfpedit.html index 7989e01..28e0109 100644 --- a/cfp/templates/cfpedit.html +++ b/cfp/templates/cfpedit.html @@ -5,10 +5,6 @@ {% endblock %} {% block formtitle %}

Edit proposed {{proposal.topic.name}} session

-{% if proposal.reviewer_notes %} -

Reviewer notes:

-

{{ proposal.reviewer_notes }}

-{% endif %} {% endblock %} {% block formfooter %} diff --git a/cfp/templates/cfpreview.html b/cfp/templates/cfpreview.html index e6bb403..297b1f8 100644 --- a/cfp/templates/cfpreview.html +++ b/cfp/templates/cfpreview.html @@ -28,8 +28,4 @@ in topic {{ proposal.topic }}

{% endfor %} {% endif %} -{% if proposal.proposer_notes %} -

Proposer notes:

-

{{ proposal.proposer_notes }}

-{% endif %} {% endblock %} diff --git a/cfp/views.py b/cfp/views.py index f55891f..6d44db8 100644 --- a/cfp/views.py +++ b/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",