Private
Public Access
1
0

implemented comments page

This commit is contained in:
Sander Roosendaal
2017-02-17 16:13:34 +01:00
parent 7ffaf18379
commit 53f51c456f
6 changed files with 455 additions and 174 deletions

View File

@@ -855,21 +855,6 @@ class RowerForm(ModelForm):
if an>=max:
raise forms.ValidationError("AN should be lower than Max")
# A comment by a user on a training
class WorkoutComment(models.Model):
created = models.DateField(default=timezone.now)
comment = models.TextField(max_length=300)
read = models.BooleanField(default=False)
user = models.ForeignKey(User)
workout = models.ForeignKey(Workout)
class WorkoutCommentForm(ModelForm):
class Meta:
model = WorkoutComment
fields = ['comment']
widgets = {
'comment': forms.Textarea,
}
# An announcement that goes to the right of the workouts list
# optionally sends a tweet to our twitter account
@@ -894,3 +879,28 @@ class SiteAnnouncement(models.Model):
except:
pass
return super(SiteAnnouncement,self).save(*args, **kwargs)
# A comment by a user on a training
class WorkoutComment(models.Model):
comment = models.TextField(max_length=300)
created = models.DateTimeField(default=timezone.now)
read = models.BooleanField(default=False)
user = models.ForeignKey(User)
workout = models.ForeignKey(Workout)
def __unicode__(self):
return u'Comment to: {w} by {u1} {u2}'.format(
w=self.workout.name,
u1 = self.user.first_name,
u2 = self.user.last_name,
)
class WorkoutCommentForm(ModelForm):
class Meta:
model = WorkoutComment
fields = ['comment',]
widgets = {
'comment': forms.Textarea,
}