a few fixes on comments
This commit is contained in:
@@ -891,7 +891,7 @@ class WorkoutComment(models.Model):
|
|||||||
comment = models.TextField(max_length=300)
|
comment = models.TextField(max_length=300)
|
||||||
created = models.DateTimeField(default=timezone.now)
|
created = models.DateTimeField(default=timezone.now)
|
||||||
read = models.BooleanField(default=False)
|
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)
|
user = models.ForeignKey(User)
|
||||||
workout = models.ForeignKey(Workout)
|
workout = models.ForeignKey(Workout)
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ def handle_sendemailnewresponse(first_name,last_name,
|
|||||||
message += '\n\n'
|
message += '\n\n'
|
||||||
message += 'You are receiving this email because you are subscribed '
|
message += 'You are receiving this email because you are subscribed '
|
||||||
message += 'to comments on this workout. To unsubscribe, follow this link:\n'
|
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,
|
email = EmailMessage(subject, message,
|
||||||
'Rowsandall <info@rowsandall.com>',
|
'Rowsandall <info@rowsandall.com>',
|
||||||
|
|||||||
@@ -3641,7 +3641,7 @@ def workout_comment_view(request,id=0):
|
|||||||
notification = cd['notification']
|
notification = cd['notification']
|
||||||
c = WorkoutComment(workout=w,user=request.user,comment=comment,
|
c = WorkoutComment(workout=w,user=request.user,comment=comment,
|
||||||
notification=notification)
|
notification=notification)
|
||||||
c.save()
|
c.save()
|
||||||
if settings.DEBUG and request.user != r.user:
|
if settings.DEBUG and request.user != r.user:
|
||||||
res = handle_sendemailnewcomment.delay(r.user.first_name,
|
res = handle_sendemailnewcomment.delay(r.user.first_name,
|
||||||
r.user.last_name,
|
r.user.last_name,
|
||||||
@@ -3661,7 +3661,7 @@ def workout_comment_view(request,id=0):
|
|||||||
comment,w.name,w.id)
|
comment,w.name,w.id)
|
||||||
|
|
||||||
commenters = {oc.user for oc in comments if oc.notification}
|
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:
|
if settings.DEBUG and u != request.user and u != r.user:
|
||||||
res = handle_sendemailnewresponse.delay(u.first_name,
|
res = handle_sendemailnewresponse.delay(u.first_name,
|
||||||
u.last_name,
|
u.last_name,
|
||||||
@@ -3671,7 +3671,7 @@ def workout_comment_view(request,id=0):
|
|||||||
comment,
|
comment,
|
||||||
w.name,
|
w.name,
|
||||||
w.id,
|
w.id,
|
||||||
c.id)
|
c.id)
|
||||||
elif u != request.user and u != r.user:
|
elif u != request.user and u != r.user:
|
||||||
res = queuelow.enqueue(handle_sendemailnewresponse,
|
res = queuelow.enqueue(handle_sendemailnewresponse,
|
||||||
u.first_name,
|
u.first_name,
|
||||||
@@ -3683,6 +3683,10 @@ def workout_comment_view(request,id=0):
|
|||||||
w.name,
|
w.name,
|
||||||
w.id,
|
w.id,
|
||||||
c.id)
|
c.id)
|
||||||
|
|
||||||
|
url = reverse(workout_comment_view,kwargs = {
|
||||||
|
'id':id})
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
form = WorkoutCommentForm()
|
form = WorkoutCommentForm()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user