implemented comments page
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user