Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Start working on read-only access

Roland Geider1623b3af431b
diff --git a/wger/core/forms.py b/wger/core/forms.py
index 15393696e..0b414f49a 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -35,7 +35,8 @@ class UserPreferencesForm(forms.ModelForm):
'notification_language',
'weight_unit',
'timer_active',
- 'timer_pause')
+ 'timer_pause',
+ 'ro_access')
class UserEmailForm(forms.ModelForm):
diff --git a/wger/core/migrations/0002_auto_20141225_1512.py b/wger/core/migrations/0002_auto_20141225_1512.py
new file mode 100644
index 000000000..a27dee203
--- /dev/null
+++ b/wger/core/migrations/0002_auto_20141225_1512.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='userprofile',
+ name='ro_access',
+ field=models.BooleanField(help_text='Allow anonymous users to access your workouts and logs in a read-only mode. You can then share the links to social media.', verbose_name='Allow read-only access', default=False),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='userprofile',
+ name='freetime_intensity',
+ field=models.CharField(choices=[('1', 'Low'), ('2', 'Medium'), ('3', 'High')], null=True, max_length=1, help_text='Approximately', default='1', verbose_name='Physical intensity'),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='userprofile',
+ name='gender',
+ field=models.CharField(choices=[('1', 'Male'), ('2', 'Female')], null=True, default='1', max_length=1),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='userprofile',
+ name='sport_intensity',
+ field=models.CharField(choices=[('1', 'Low'), ('2', 'Medium'), ('3', 'High')], null=True, max_length=1, help_text='Approximately', default='2', verbose_name='Physical intensity'),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='userprofile',
+ name='weight_unit',
+ field=models.CharField(choices=[('kg', 'Metric (kilogram)'), ('lb', 'Imperial (pound)')], verbose_name='Weight unit', max_length=2, default='kg'),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='userprofile',
+ name='work_intensity',
+ field=models.CharField(choices=[('1', 'Low'), ('2', 'Medium'), ('3', 'High')], null=True, max_length=1, help_text='Approximately', default='1', verbose_name='Physical intensity'),
+ preserve_default=True,
+ ),
+ ]
diff --git a/wger/core/models.py b/wger/core/models.py
index d443f3f8b..f9d063cb8 100644
--- a/wger/core/models.py
+++ b/wger/core/models.py
@@ -297,6 +297,13 @@ by the US Department of Agriculture. It is extremely complete, with around
default=UNITS_KG)
'''Preferred weight unit'''
+ ro_access = models.BooleanField(verbose_name=_('Allow read-only access'),
+ help_text=_('Allow anonymous users to access your workouts and '
+ 'logs in a read-only mode. You can then share the '
+ 'links to social media.'),
+ default=False)
+ '''Allow anonymous read-only access'''
+
@property
def weight(self):
'''
diff --git a/wger/core/templates/user/preferences.html b/wger/core/templates/user/preferences.html
index de7f9882c..1d1c88461 100644
--- a/wger/core/templates/user/preferences.html
+++ b/wger/core/templates/user/preferences.html
@@ -88,6 +88,7 @@ $(function() {
</div>
<div id="collapseOther" class="panel-collapse collapse">
<div class="panel-body">
+ {% render_form_field form.ro_access %}
{% render_form_field form.notification_language %}
{% render_form_field form.weight_unit %}
{% render_form_field form.show_comments %}