Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Properly remove unused userprofile fields...

Roland Geider2fb6906fd777
diff --git a/wger/core/forms.py b/wger/core/forms.py
index 2dc786eb6..780b84d67 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -147,12 +147,8 @@ class UserPreferencesForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = (
- 'workout_reminder_active',
- 'workout_reminder',
- 'workout_duration',
'notification_language',
'weight_unit',
- 'num_days_weight_reminder',
'birthdate',
'height',
)
@@ -181,20 +177,11 @@ class UserPreferencesForm(forms.ModelForm):
),
'birthdate',
'height',
- # HTML('<hr>'),
),
- # Fieldset(
- # _('Workout reminders'),
- # 'workout_reminder_active',
- # 'workout_reminder',
- # 'workout_duration',
- # HTML('<hr>'),
- # ),
Fieldset(
_('Other settings'),
'notification_language',
'weight_unit',
- # 'num_days_weight_reminder',
),
ButtonHolder(Submit('submit', _('Save'), css_class='btn-success btn-block')),
)
diff --git a/wger/core/tests/test_preferences.py b/wger/core/tests/test_preferences.py
index f7fda335f..0562e2f8c 100644
--- a/wger/core/tests/test_preferences.py
+++ b/wger/core/tests/test_preferences.py
@@ -41,11 +41,7 @@ class PreferencesTestCase(WgerTestCase):
self.form_data = {
'first_name': '',
'last_name': '',
- 'workout_reminder_active': True,
- 'workout_reminder': 30,
- 'workout_duration': 12,
'notification_language': 2,
- 'num_days_weight_reminder': 10,
'weight_unit': 'kg',
'birthdate': '02/25/1987',
'height': 180,
@@ -72,10 +68,6 @@ class PreferencesTestCase(WgerTestCase):
self.assertEqual(response.status_code, 302)
response = self.client.get(reverse('core:user:preferences'))
user = User.objects.get(username='test')
- profile = user.userprofile
- self.assertTrue(profile.workout_reminder_active)
- self.assertEqual(profile.workout_reminder, 30)
- self.assertEqual(profile.workout_duration, 12)
self.assertEqual(user.first_name, 'Test')
self.assertEqual(user.last_name, 'User')
@@ -84,8 +76,6 @@ class PreferencesTestCase(WgerTestCase):
reverse('core:user:preferences'),
{
**self.form_data,
- 'workout_reminder': 22,
- 'workout_duration': 10,
'weight_unit': 'lb',
'height': 170,
},
@@ -94,8 +84,8 @@ class PreferencesTestCase(WgerTestCase):
self.assertEqual(response.status_code, 302)
response = self.client.get(reverse('core:user:preferences'))
profile = response.context['user'].userprofile
- self.assertEqual(profile.workout_reminder, 22)
self.assertEqual(profile.weight_unit, 'lb')
+ self.assertEqual(profile.height, 170)
def test_height_is_optional(self):
"""The preferences form saves without a height."""