add review message form
This commit is contained in:
parent
e00b646f20
commit
7b4c5cd205
2 changed files with 41 additions and 1 deletions
|
@ -33,7 +33,7 @@ class ProposalSection(models.Model):
|
||||||
start = models.DateTimeField(null=True, blank=True)
|
start = models.DateTimeField(null=True, blank=True)
|
||||||
end = models.DateTimeField(null=True, blank=True)
|
end = models.DateTimeField(null=True, blank=True)
|
||||||
closed = models.NullBooleanField()
|
closed = models.NullBooleanField()
|
||||||
published = models.NullBooleanField() # @@@ what is this used for?
|
published = models.NullBooleanField()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def available(cls):
|
def available(cls):
|
||||||
|
|
|
@ -10,6 +10,7 @@ from django.utils.hashcompat import sha_constructor
|
||||||
from django.views import static
|
from django.views import static
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
from account.models import EmailAddress
|
from account.models import EmailAddress
|
||||||
|
@ -206,8 +207,47 @@ def proposal_detail(request, pk):
|
||||||
if request.user not in [p.user for p in proposal.speakers()]:
|
if request.user not in [p.user for p in proposal.speakers()]:
|
||||||
raise Http404()
|
raise Http404()
|
||||||
|
|
||||||
|
if "symposion.reviews" in settings.INSTALLED_APPS:
|
||||||
|
from symposion.reviews.forms import SpeakerCommentForm
|
||||||
|
message_form = SpeakerCommentForm()
|
||||||
|
if request.method == "POST":
|
||||||
|
message_form = SpeakerCommentForm(request.POST)
|
||||||
|
if message_form.is_valid():
|
||||||
|
|
||||||
|
message = message_form.save(commit=False)
|
||||||
|
message.user = request.user
|
||||||
|
message.proposal = proposal
|
||||||
|
message.save()
|
||||||
|
|
||||||
|
ProposalMessage = SpeakerCommentForm.Meta.model
|
||||||
|
reviewers = User.objects.filter(
|
||||||
|
id__in=ProposalMessage.objects.filter(
|
||||||
|
proposal=proposal
|
||||||
|
).exclude(
|
||||||
|
user=request.user
|
||||||
|
).distinct().values_list("user", flat=True)
|
||||||
|
)
|
||||||
|
|
||||||
|
for reviewer in reviewers:
|
||||||
|
ctx = {
|
||||||
|
"proposal": proposal,
|
||||||
|
"message": message,
|
||||||
|
"reviewer": True,
|
||||||
|
}
|
||||||
|
send_email(
|
||||||
|
[reviewer.email], "proposal_new_message",
|
||||||
|
context=ctx
|
||||||
|
)
|
||||||
|
|
||||||
|
return redirect(request.path)
|
||||||
|
else:
|
||||||
|
message_form = SpeakerCommentForm()
|
||||||
|
else:
|
||||||
|
message_form = None
|
||||||
|
|
||||||
return render(request, "proposals/proposal_detail.html", {
|
return render(request, "proposals/proposal_detail.html", {
|
||||||
"proposal": proposal,
|
"proposal": proposal,
|
||||||
|
"message_form": message_form
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue