Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix some pep8 formatting errors and the schedule test

Roland Geider5fec491700a3
diff --git a/wger/manager/templatetags/wger_extras.py b/wger/manager/templatetags/wger_extras.py
index 8188c5cfa..d08088e6f 100644
--- a/wger/manager/templatetags/wger_extras.py
+++ b/wger/manager/templatetags/wger_extras.py
@@ -92,12 +92,7 @@ def form_field_add_css(field, css):
Adds a CSS class to a form field. This is needed among other places for
bootstrap 3, which needs a 'form-control' class in the field itself
'''
- #return field.as_widget(attrs={"class": css})
- #return field
- if hasattr(field, 'as_widget'):
- return field.as_widget(attrs={"class": css})
- else:
- return field
+ return field.as_widget(attrs={"class": css})
@register.filter(name='is_checkbox')
@@ -110,6 +105,7 @@ def is_checkbox(field):
'''
return field.field.widget.__class__.__name__ == CheckboxInput().__class__.__name__
+
@register.inclusion_tag('tags/yaml_form_element.html')
def yaml_form_field(field, css_class='ym-fbox-text'):
'''
diff --git a/wger/manager/tests/test_schedule.py b/wger/manager/tests/test_schedule.py
index fb77b2ae8..70688dfeb 100644
--- a/wger/manager/tests/test_schedule.py
+++ b/wger/manager/tests/test_schedule.py
@@ -127,7 +127,7 @@ class ScheduleTestCase(WorkoutManagerTestCase):
if self.is_mobile:
self.assertContains(response, '<p class="ui-li-aside"><em>active</em></p>')
else:
- self.assertContains(response, '<span class="label label-info">active</span>')
+ self.assertContains(response, '<span class="label label-primary">active</span>')
schedule = Schedule.objects.get(pk=4)
schedule.is_active = False
schedule.save()
@@ -138,7 +138,7 @@ class ScheduleTestCase(WorkoutManagerTestCase):
if self.is_mobile:
self.assertNotContains(response, '<p class="ui-li-aside"><em>active</em></p>')
else:
- self.assertNotContains(response, '<span class="label label-info">active</span>')
+ self.assertNotContains(response, '<span class="label label-primary">active</span>')
def test_schedule_active(self):
'''
diff --git a/wger/manager/views/log.py b/wger/manager/views/log.py
index b9e3236ed..cdeba56b3 100644
--- a/wger/manager/views/log.py
+++ b/wger/manager/views/log.py
@@ -315,7 +315,6 @@ class WorkoutCalendar(HTMLCalendar):
super(WorkoutCalendar, self).__init__()
self.workout_logs = self.group_by_day(workout_logs)
-
def formatday(self, day, weekday):
if day != 0:
cssclass = self.cssclasses[weekday]