adding functionality to comment on planned sessions and races
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user