Private
Public Access
1
0

Initial version of workout choice field

This commit is contained in:
Sander Roosendaal
2017-02-18 09:50:09 +01:00
parent a36b2f1693
commit 33afb8800b
5 changed files with 211 additions and 9 deletions

View File

@@ -398,17 +398,23 @@ class Workout(models.Model):
privacy = models.CharField(default='visible',max_length=30,
choices=privacychoices)
def __str__(self):
def __unicode__(self):
date = self.date
name = self.name
distance = str(self.distance)
ownerfirst = self.user.user.first_name
ownerlast = self.user.user.last_name
duration = self.duration
try:
stri = date.strftime('%Y-%m-%d')+'_'+name
except AttributeError:
stri = str(date)+'_'+name
stri = u'{d}_{n}_{dist}m_{duration:%H:%M:%S}_{ownerfirst}_{ownerlast}'.format(
d = date.strftime('%Y-%m-%d'),
n = name,
dist = distance,
duration = duration,
ownerfirst = ownerfirst,
ownerlast = ownerlast,
)
return stri
@@ -890,7 +896,7 @@ class WorkoutComment(models.Model):
def __unicode__(self):
return u'Comment to: {w} by {u1} {u2}'.format(
w=self.workout.name,
w=self.workout,
u1 = self.user.first_name,
u2 = self.user.last_name,
)