Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove AJAX update method, set_english-ingredients is not used anywhere

Roland Geider48c093222517
diff --git a/wger/core/tests/test_preferences.py b/wger/core/tests/test_preferences.py
index 4a875a852..2ee2986c1 100644
--- a/wger/core/tests/test_preferences.py
+++ b/wger/core/tests/test_preferences.py
@@ -168,40 +168,6 @@ class UserBodyweightTestCase(WorkoutManagerTestCase):
self.assertEqual(entry.weight, 100)
-class AjaxPreferencesTestCase(WorkoutManagerTestCase):
- '''
- Tests editing user preferences via AJAX
- '''
-
- def preferences(self):
- '''
- Helper function to test the preferences page
- '''
-
- # Set the 'english ingredients' option
- response = self.client.get(reverse('core:user-api-preferences'),
- {'do': 'set_english-ingredients',
- 'show': '1'},
- HTTP_X_REQUESTED_WITH='XMLHttpRequest')
-
- self.assertEqual('Success', response.content)
- self.assertEqual(response.status_code, 200)
-
- response = self.client.get(reverse('core:preferences'))
- profile = response.context['user'].userprofile
- self.assertTrue(profile.show_comments)
- self.assertTrue(profile.show_english_ingredients)
- self.assertEqual(response.context['user'].email, '[email protected]')
-
- def test_preferences_logged_in(self):
- '''
- Tests the preferences page as a logged in user
- '''
-
- self.user_login('test')
- self.preferences()
-
-
class PreferencesCalculationsTestCase(WorkoutManagerTestCase):
'''
Tests the different calculation method in the user profile
diff --git a/wger/core/urls.py b/wger/core/urls.py
index da33ee49d..ca96f556f 100644
--- a/wger/core/urls.py
+++ b/wger/core/urls.py
@@ -54,11 +54,6 @@ urlpatterns = patterns('',
misc.demo_entries,
name='demo-entries'),
- # AJAX!
- url(r'^workout/api/user-preferences$',
- user.api_user_preferences,
- name='user-api-preferences'),
-
# Licenses
url(r'^license/list$',
license.LicenseListView.as_view(),
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 93c1aa30d..2a6d168af 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -164,25 +164,6 @@ def preferences(request):
return render(request, 'user/preferences.html', template_data)
-@login_required
-def api_user_preferences(request):
- '''
- Allows the user to edit its preferences via AJAX calls
- '''
-
- if request.is_ajax():
-
- # Show ingredients in english
- if request.GET.get('do') == 'set_english-ingredients':
- new_value = int(request.GET.get('show'))
-
- profile = request.user.userprofile
- profile.show_english_ingredients = new_value
- profile.save()
-
- return HttpResponse(_('Success'))
-
-
@login_required
def api_key(request):
'''