Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix potential unicode problems

Roland Geiderf26544fac5dc
diff --git a/wger/exercises/views/categories.py b/wger/exercises/views/categories.py
index 8fdd7fac5..117ea77b1 100644
--- a/wger/exercises/views/categories.py
+++ b/wger/exercises/views/categories.py
@@ -71,7 +71,7 @@ class ExerciseCategoryUpdateView(WgerFormMixin, UpdateView, WgerPermissionMixin)
def get_context_data(self, **kwargs):
context = super(ExerciseCategoryUpdateView, self).get_context_data(**kwargs)
context['form_action'] = reverse('exercisecategory-edit', kwargs={'pk': self.object.id})
- context['title'] = _('Edit %s') % self.object.name
+ context['title'] = _(u'Edit %s') % self.object.name
return context
@@ -96,7 +96,7 @@ class ExerciseCategoryDeleteView(WgerDeleteMixin, DeleteView, WgerPermissionMixi
def get_context_data(self, **kwargs):
context = super(ExerciseCategoryDeleteView, self).get_context_data(**kwargs)
- context['title'] = _('Delete category %s?') % self.object.name
+ context['title'] = _(u'Delete category %s?') % self.object.name
context['form_action'] = reverse('exercisecategory-delete', kwargs={'pk': self.object.id})
return context
diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.py
index 311f31dc1..bdcc40c76 100644
--- a/wger/exercises/views/exercises.py
+++ b/wger/exercises/views/exercises.py
@@ -197,7 +197,7 @@ class ExerciseUpdateView(ExercisesEditAddView, UpdateView, WgerPermissionMixin):
def get_context_data(self, **kwargs):
context = super(ExerciseUpdateView, self).get_context_data(**kwargs)
context['form_action'] = reverse('exercise-edit', kwargs={'pk': self.object.id})
- context['title'] = _('Edit %s') % self.object.name
+ context['title'] = _(u'Edit %s') % self.object.name
return context
@@ -228,7 +228,7 @@ class ExerciseAddView(ExercisesEditAddView, CreateView, WgerPermissionMixin):
form.instance.license_author = self.request.user.username
subject = _('New user submitted exercise')
- message = _('''The user {0} submitted a new exercise "{1}".'''.format(
+ message = _(u'''The user {0} submitted a new exercise "{1}".'''.format(
self.request.user.username, form.instance.name))
mail.mail_admins(subject,
message,
@@ -262,7 +262,7 @@ class ExerciseDeleteView(WgerDeleteMixin, DeleteView):
Send some additional data to the template
'''
context = super(ExerciseDeleteView, self).get_context_data(**kwargs)
- context['title'] = _('Delete exercise %s?') % self.object.name
+ context['title'] = _(u'Delete exercise %s?') % self.object.name
context['form_action'] = reverse('exercise-delete', kwargs={'pk': self.kwargs['pk']})
return context
diff --git a/wger/exercises/views/muscles.py b/wger/exercises/views/muscles.py
index ad5e92e48..3e7252996 100644
--- a/wger/exercises/views/muscles.py
+++ b/wger/exercises/views/muscles.py
@@ -82,7 +82,7 @@ class MuscleUpdateView(WgerFormMixin, UpdateView, WgerPermissionMixin):
'''
context = super(MuscleUpdateView, self).get_context_data(**kwargs)
context['form_action'] = reverse('muscle-edit', kwargs={'pk': self.object.id})
- context['title'] = _('Edit %s') % self.object.name
+ context['title'] = _(u'Edit %s') % self.object.name
return context
@@ -100,6 +100,6 @@ class MuscleDeleteView(WgerDeleteMixin, DeleteView, WgerPermissionMixin):
Send some additional data to the template
'''
context = super(MuscleDeleteView, self).get_context_data(**kwargs)
- context['title'] = _('Delete muscle %s?') % self.object.name
+ context['title'] = _(u'Delete muscle %s?') % self.object.name
context['form_action'] = reverse('muscle-delete', kwargs={'pk': self.kwargs['pk']})
return context
diff --git a/wger/manager/views/log.py b/wger/manager/views/log.py
index d773c423c..7d59ac893 100644
--- a/wger/manager/views/log.py
+++ b/wger/manager/views/log.py
@@ -70,7 +70,7 @@ class WorkoutLogUpdateView(WgerFormMixin, UpdateView, WgerPermissionMixin):
def get_context_data(self, **kwargs):
context = super(WorkoutLogUpdateView, self).get_context_data(**kwargs)
context['form_action'] = reverse('workout-log-edit', kwargs={'pk': self.object.id})
- context['title'] = _('Edit log entry for %s') % self.object.exercise.name
+ context['title'] = _(u'Edit log entry for %s') % self.object.exercise.name
return context
diff --git a/wger/nutrition/views/ingredient.py b/wger/nutrition/views/ingredient.py
index 7c8fa949e..9f2e857ca 100644
--- a/wger/nutrition/views/ingredient.py
+++ b/wger/nutrition/views/ingredient.py
@@ -108,7 +108,7 @@ class IngredientDeleteView(WgerDeleteMixin, DeleteView, WgerPermissionMixin):
def get_context_data(self, **kwargs):
context = super(IngredientDeleteView, self).get_context_data(**kwargs)
- context['title'] = _('Delete %s?') % self.object.name
+ context['title'] = _(u'Delete %s?') % self.object.name
context['form_action'] = reverse('ingredient-delete', kwargs={'pk': self.object.id})
return context
@@ -161,7 +161,7 @@ class IngredientCreateView(IngredientMixin, CreateView):
form.instance.status = Ingredient.INGREDIENT_STATUS_ADMIN
else:
subject = _('New user submitted ingredient')
- message = _('''The user {0} submitted a new ingredient "{1}".'''.format(
+ message = _(u'''The user {0} submitted a new ingredient "{1}".'''.format(
self.request.user.username, form.instance.name))
mail.mail_admins(subject,
message,
diff --git a/wger/nutrition/views/meal_item.py b/wger/nutrition/views/meal_item.py
index 412fd9072..dc99feeb7 100644
--- a/wger/nutrition/views/meal_item.py
+++ b/wger/nutrition/views/meal_item.py
@@ -115,7 +115,6 @@ class MealItemCreateView(WgerFormMixin, CreateView):
'''
context = super(MealItemCreateView, self).get_context_data(**kwargs)
context['form_action'] = reverse('mealitem-add', kwargs={'meal_id': self.meal.id})
- #context['ingredient'] = self.request.POST.get('ingredient', '')
context['ingredient_searchfield'] = self.request.POST.get('ingredient_searchfield', '')
return context
@@ -147,6 +146,5 @@ class MealItemEditView(WgerFormMixin, UpdateView):
Send some additional data to the template
'''
context = super(MealItemEditView, self).get_context_data(**kwargs)
- #context['ingredient'] = self.object.ingredient.id
context['ingredient_searchfield'] = self.object.ingredient.name
return context