Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Merge pull request #85

Roland Geiderb06f69a2a2a3
diff --cc requirements.txt
index 23d98693f,a38679834..c971f1d91
--- a/requirements.txt
+++ b/requirements.txt
@@@ -14,11 -15,6 +14,12 @@@ pillo
easy-thumbnails
django_compressor
icalendar
++django-bootstrap-breadcrumbs
+
+# REST API
djangorestframework==2.3.13
django-filter
-django-bootstrap-breadcrumbs
+django-tastypie==0.9.16
+
+# Python3 compatibility
+six
diff --cc wger/core/forms.py
index 6c6434817,563950bd1..061440e60
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@@ -106,18 -129,11 +129,18 @@@ class FeedbackRegisteredForm(forms.Form
'''
Feedback form used for logged in users
'''
- contact = CharField(max_length=50,
- min_length=10,
- label=_('Contact'),
- help_text=_('Some way of answering your (email, etc.)'),
- required=False)
-
- comment = CharField(max_length=500,
- min_length=10,
- widget=widgets.Textarea,
- label=_('Comment'),
- help_text=_('What do you want to say?'),
- required=True)
++ contact = forms.CharField(max_length=50,
++ min_length=10,
++ label=_('Contact'),
++ help_text=_('Some way of answering your (email, etc.)'),
++ required=False)
++
+ comment = forms.CharField(max_length=500,
+ min_length=10,
+ widget=widgets.Textarea,
++ label=_('Comment'),
+ help_text=_('What do you want to say?'),
+ required=True)
class FeedbackAnonymousForm(FeedbackRegisteredForm):
diff --cc wger/core/templates/mobile/template.html
index 1809a22c8,88208b95b..23144f31f
--- a/wger/core/templates/mobile/template.html
+++ b/wger/core/templates/mobile/template.html
@@@ -1,5 -1,9 +1,8 @@@
<!DOCTYPE html>
- {% load i18n staticfiles cache compress wger_extras %}
-{% load i18n browserid staticfiles wger_extras compress django_bootstrap_breadcrumbs %}
++{% load i18n staticfiles wger_extras compress django_bootstrap_breadcrumbs %}
+ {% block breadcrumbs %}
+ {% clear_breadcrumbs %}
+ {% endblock %}
-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
diff --cc wger/core/templates/template.html
index c7f64b80d,192da3793..7d36e69c9
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@@ -1,5 -1,9 +1,8 @@@
<!DOCTYPE html>
- {% load i18n staticfiles wger_extras compress %}
-{% load i18n browserid staticfiles wger_extras compress django_bootstrap_breadcrumbs %}
++{% load i18n staticfiles wger_extras compress django_bootstrap_breadcrumbs %}
+ {% block breadcrumbs %}
+ {% clear_breadcrumbs %}
+ {% endblock %}
-
<html lang="{{language.short_name}}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
diff --cc wger/manager/tests/testcase.py
index a7778b4c4,035662e15..6f18c91a0
--- a/wger/manager/tests/testcase.py
+++ b/wger/manager/tests/testcase.py
@@@ -41,9 -39,43 +41,43 @@@ def get_reverse(url, kwargs={})
# everything was already done in the individual test case
url = url
- return url
+ return six.text_type(url)
+ def get_user_list(users):
+ '''
+ Helper function that returns a list with users to test
+ '''
+ if isinstance(users, tuple):
+ return users
+ else:
+ return [users]
+
+
+ def delete_testcase_add_methods(cls):
+ '''
+ Helper function that dynamically adds test methods.
+
+ This is a bit of a hack, but it's the easiest way of making sure that
+ all the setup and teardown work is performed for each test user (and,
+ most importantly for us, that the database is reseted every time).
+
+ This must be called if the testcase has more than one success user
+ '''
+
+ for user in get_user_list(cls.user_fail):
+ def test_unauthorized(self):
+ self.user_login(user)
+ self.delete_object(fail=False)
+ setattr(cls, 'test_unauthorized_{0}'.format(user), test_unauthorized)
+
+ for user in get_user_list(cls.user_success):
+ def test_authorized(self):
+ self.user_login(user)
+ self.delete_object(fail=False)
+ setattr(cls, 'test_authorized_{0}'.format(user), test_authorized)
+
+
class BaseTestCase(object):
'''
Base test case.
diff --cc wger/nutrition/tests/test_weight_unit_ingredient.py
index 485382f0c,4260d2431..60f9d2a5c
--- a/wger/nutrition/tests/test_weight_unit_ingredient.py
+++ b/wger/nutrition/tests/test_weight_unit_ingredient.py
@@@ -35,9 -35,8 +35,8 @@@ class AddWeightUnitIngredientTestCase(W
url = reverse_lazy('weight-unit-ingredient-add',
kwargs={'ingredient_pk': 1})
data = {'unit': 5,
- 'gramm': 123,
+ 'gram': 123,
'amount': 1}
- pk = 9875
class DeleteWeightUnitIngredientTestCase(WorkoutManagerDeleteTestCase):
diff --cc wger/software/templates/changelog.html
index ddc71a975,f6b4d2abc..1cc0d1480
--- a/wger/software/templates/changelog.html
+++ b/wger/software/templates/changelog.html
@@@ -11,12 -11,13 +11,18 @@@
<h4>2014-XX-XX</h4>
<ul>
- <li>New Translation: Dutch (many thanks to David Machiels!)</li>
+ <li>New Translations:
+ <ul>
+ <li>Dutch (many thanks to David Machiels!)</li>
+ <li>Portuguese (many thanks to Jefferson Campos! - <a href="http://jeffersoncampos.eti.br">website</a>, <a href="https://github.com/foguinhoperuca">github</a>)</li>
+ </ul>
+ </li>
+ <li>Add support for gym management
+ <ul>
+ <li>Gym managers can create and manage gyms</li>
+ <li>Trainers can see the gym's users and their routines</li>
+ </ul>
+ </li>
<li>Reduce amount of CSS and JS libraries by using bootstrap as much as possible</li>
<li>Improvements to the REST API
<ul>
diff --cc wger/weight/tests/test_entry.py
index 02f031666,8bf9e6fad..85c50c3d1
--- a/wger/weight/tests/test_entry.py
+++ b/wger/weight/tests/test_entry.py
@@@ -31,9 -28,8 +31,8 @@@ class AddWeightEntryTestCase(WorkoutMan
object_class = WeightEntry
url = 'weight-add'
- pk = 8
user_fail = False
- data = {'weight': 81.1,
+ data = {'weight': decimal.Decimal(81.1).quantize(TWOPLACES),
'creation_date': datetime.date(2013, 2, 1),
'user': 1}