added privacy settings to workouts & users
This commit is contained in:
@@ -204,6 +204,11 @@ class Rower(models.Model):
|
||||
('coach','coach')
|
||||
)
|
||||
|
||||
privacychoices = (
|
||||
('visible','Visible'),
|
||||
('hidden','Hidden'),
|
||||
)
|
||||
|
||||
rowerplan = models.CharField(default='basic',max_length=30,
|
||||
choices=plans)
|
||||
|
||||
@@ -211,8 +216,11 @@ class Rower(models.Model):
|
||||
teamplanexpires = models.DateField(default=timezone.now)
|
||||
clubsize = models.IntegerField(default=0)
|
||||
|
||||
|
||||
# Friends/Team
|
||||
friends = models.ManyToManyField("self",blank=True)
|
||||
privacy = models.CharField(default='visible',max_length=30,
|
||||
choices=privacychoices)
|
||||
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
|
||||
@@ -359,6 +367,11 @@ class Workout(models.Model):
|
||||
('4-', '4- (four)'),
|
||||
('8+', '8+ (eight)'),
|
||||
)
|
||||
|
||||
privacychoices = (
|
||||
('private','Private'),
|
||||
('visible','Visible'),
|
||||
)
|
||||
|
||||
user = models.ForeignKey(Rower)
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
@@ -382,6 +395,8 @@ class Workout(models.Model):
|
||||
uploadedtosporttracks = models.IntegerField(default=0)
|
||||
notes = models.CharField(blank=True,null=True,max_length=200)
|
||||
summary = models.TextField(blank=True)
|
||||
privacy = models.CharField(default='visible',max_length=30,
|
||||
choices=privacychoices)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -499,7 +514,7 @@ class WorkoutForm(ModelForm):
|
||||
duration = forms.TimeInput(format='%H:%M:%S.%f')
|
||||
class Meta:
|
||||
model = Workout
|
||||
fields = ['name','date','starttime','duration','distance','workouttype','boattype','notes']
|
||||
fields = ['name','date','starttime','duration','distance','workouttype','notes','privacy','boattype']
|
||||
widgets = {
|
||||
'date': DateInput(),
|
||||
'notes': forms.Textarea,
|
||||
@@ -508,9 +523,12 @@ class WorkoutForm(ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(WorkoutForm, self).__init__(*args, **kwargs)
|
||||
# this line to be removed
|
||||
del self.fields['privacy']
|
||||
|
||||
if self.instance.workouttype != 'water':
|
||||
del self.fields['boattype']
|
||||
|
||||
|
||||
# Used for the rowing physics calculations
|
||||
class AdvancedWorkoutForm(ModelForm):
|
||||
class Meta:
|
||||
|
||||
Reference in New Issue
Block a user