Private
Public Access
1
0

a few fixes on comments

This commit is contained in:
Sander Roosendaal
2017-02-23 18:14:43 +01:00
parent 1d9dc829ae
commit 7dcdaa516b
3 changed files with 9 additions and 5 deletions

View File

@@ -891,7 +891,7 @@ class WorkoutComment(models.Model):
comment = models.TextField(max_length=300)
created = models.DateTimeField(default=timezone.now)
read = models.BooleanField(default=False)
notification = models.BooleanField(default=False,verbose_name="Send me notifications")
notification = models.BooleanField(default=True,verbose_name="Subscribe to new comment notifications")
user = models.ForeignKey(User)
workout = models.ForeignKey(Workout)

View File

@@ -293,7 +293,7 @@ def handle_sendemailnewresponse(first_name,last_name,
message += '\n\n'
message += 'You are receiving this email because you are subscribed '
message += 'to comments on this workout. To unsubscribe, follow this link:\n'
message += 'https://rowsandall.com/rowers/workout/unsubscribe/'+str(workoutid)+'/'
message += 'https://rowsandall.com/rowers/workout/'+str(workoutid)+'/unsubscribe'
email = EmailMessage(subject, message,
'Rowsandall <info@rowsandall.com>',

View File

@@ -3641,7 +3641,7 @@ def workout_comment_view(request,id=0):
notification = cd['notification']
c = WorkoutComment(workout=w,user=request.user,comment=comment,
notification=notification)
c.save()
c.save()
if settings.DEBUG and request.user != r.user:
res = handle_sendemailnewcomment.delay(r.user.first_name,
r.user.last_name,
@@ -3661,7 +3661,7 @@ def workout_comment_view(request,id=0):
comment,w.name,w.id)
commenters = {oc.user for oc in comments if oc.notification}
for u in commenters:
for u in commenters:
if settings.DEBUG and u != request.user and u != r.user:
res = handle_sendemailnewresponse.delay(u.first_name,
u.last_name,
@@ -3671,7 +3671,7 @@ def workout_comment_view(request,id=0):
comment,
w.name,
w.id,
c.id)
c.id)
elif u != request.user and u != r.user:
res = queuelow.enqueue(handle_sendemailnewresponse,
u.first_name,
@@ -3683,6 +3683,10 @@ def workout_comment_view(request,id=0):
w.name,
w.id,
c.id)
url = reverse(workout_comment_view,kwargs = {
'id':id})
return HttpResponseRedirect(url)
form = WorkoutCommentForm()