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.pyindex 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.namereturn context@@ -96,7 +96,7 @@ class ExerciseCategoryDeleteView(WgerDeleteMixin, DeleteView, WgerPermissionMixidef 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.namecontext['form_action'] = reverse('exercisecategory-delete', kwargs={'pk': self.object.id})return contextdiff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.pyindex 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.namereturn context@@ -228,7 +228,7 @@ class ExerciseAddView(ExercisesEditAddView, CreateView, WgerPermissionMixin):form.instance.license_author = self.request.user.usernamesubject = _('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.namecontext['form_action'] = reverse('exercise-delete', kwargs={'pk': self.kwargs['pk']})return contextdiff --git a/wger/exercises/views/muscles.py b/wger/exercises/views/muscles.pyindex 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.namereturn 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.namecontext['form_action'] = reverse('muscle-delete', kwargs={'pk': self.kwargs['pk']})return contextdiff --git a/wger/manager/views/log.py b/wger/manager/views/log.pyindex 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.namereturn contextdiff --git a/wger/nutrition/views/ingredient.py b/wger/nutrition/views/ingredient.pyindex 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.namecontext['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_ADMINelse: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.pyindex 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.idcontext['ingredient_searchfield'] = self.object.ingredient.namereturn context