Private
Public Access
1
0

adding functionality to comment on planned sessions and races

This commit is contained in:
Sander Roosendaal
2019-02-13 15:13:49 +01:00
parent da4d39709e
commit 3709ad7ccb
12 changed files with 305 additions and 10 deletions

View File

@@ -3343,3 +3343,28 @@ class WorkoutCommentForm(ModelForm):
'comment': forms.Textarea,
}
# A comment by a user on a training
class PlannedSessionComment(models.Model):
comment = models.TextField(max_length=300)
created = models.DateTimeField(default=timezone.now)
read = models.BooleanField(default=False)
notification = models.BooleanField(default=True,verbose_name="Subscribe to new comment notifications")
user = models.ForeignKey(User)
plannedsession = models.ForeignKey(PlannedSession)
def __unicode__(self):
return u'Comment to: {w} by {u1} {u2}'.format(
w=self.workout,
u1 = self.user.first_name,
u2 = self.user.last_name,
)
class PlannedSessionCommentForm(ModelForm):
class Meta:
model = PlannedSessionComment
fields = ['comment','notification']
widgets = {
'comment': forms.Textarea,
}