diff --git a/wger/core/views/misc.py b/wger/core/views/misc.py index d392677c6..93614bb2e 100644 --- a/wger/core/views/misc.py +++ b/wger/core/views/misc.py @@ -182,7 +182,6 @@ def get_context_data(self, **kwargs): context['form_fields'] = context['form'] context['submit_text'] = _('Send') context['contribute_url'] = reverse('software:contribute') - context['extend_template'] = 'base_empty.html' if self.request.is_ajax() else 'base.html' return context def get_form_class(self): diff --git a/wger/core/views/user.py b/wger/core/views/user.py index 16df45cea..108b0b3fa 100644 --- a/wger/core/views/user.py +++ b/wger/core/views/user.py @@ -285,7 +285,6 @@ def registration(request): template_data['form'] = form template_data['title'] = _('Register') - template_data['extend_template'] = 'base.html' return render(request, 'form.html', template_data) @@ -576,11 +575,6 @@ def get_form(self, form_class=None): ) return form - def get_context_data(self, **kwargs): - context = super(WgerPasswordChangeView, self).get_context_data(**kwargs) - context['extend_template'] = 'base.html' - return context - class WgerPasswordResetView(PasswordResetView): template_name = 'form.html' @@ -594,11 +588,6 @@ def get_form(self, form_class=None): form.helper.add_input(Submit('submit', _("Save"), css_class='btn-success btn-block')) return form - def get_context_data(self, **kwargs): - context = super(WgerPasswordResetView, self).get_context_data(**kwargs) - context['extend_template'] = 'base.html' - return context - class WgerPasswordResetConfirmView(PasswordResetConfirmView): template_name = 'form.html' @@ -609,8 +598,3 @@ def get_form(self, form_class=None): form.helper.form_class = 'wger-form' form.helper.add_input(Submit('submit', _("Save"), css_class='btn-success btn-block')) return form - - def get_context_data(self, **kwargs): - context = super(WgerPasswordResetConfirmView, self).get_context_data(**kwargs) - context['extend_template'] = 'base.html' - return context diff --git a/wger/gym/views/gym.py b/wger/gym/views/gym.py index 7516aeaf2..16cd6e626 100644 --- a/wger/gym/views/gym.py +++ b/wger/gym/views/gym.py @@ -315,7 +315,6 @@ def gym_permissions_user_edit(request, user_pk): context = {'title': member.get_full_name(), 'form': form, - 'extend_template': 'base_empty.html' if request.is_ajax() else 'base.html', 'submit_text': 'Save'} return render(request, 'form.html', context) diff --git a/wger/manager/views/log.py b/wger/manager/views/log.py index 725273bbe..4ac01a931 100644 --- a/wger/manager/views/log.py +++ b/wger/manager/views/log.py @@ -227,7 +227,6 @@ def add(request, pk): context['helper'] = WorkoutLogFormHelper() context['session_form'] = session_form context['form'] = session_form - context['extend_template'] = 'base.html' context['form_action'] = request.path return render(request, 'log/add.html', context) diff --git a/wger/manager/views/set.py b/wger/manager/views/set.py index ffa656dd3..2b2bae693 100644 --- a/wger/manager/views/set.py +++ b/wger/manager/views/set.py @@ -120,7 +120,6 @@ def create(request, day_pk): context['max_sets'] = Set.MAX_SETS context['formsets'] = formsets context['helper'] = WorkoutLogFormHelper() - context['extend_template'] = 'base_empty.html' if request.is_ajax() else 'base.html' return render(request, 'set/add.html', context) diff --git a/wger/manager/views/workout.py b/wger/manager/views/workout.py index 8c2356f35..3e073517d 100644 --- a/wger/manager/views/workout.py +++ b/wger/manager/views/workout.py @@ -192,7 +192,6 @@ def copy_workout(request, pk): template_data['form'] = workout_form template_data['form_fields'] = [workout_form['comment']] template_data['submit_text'] = _('Copy') - template_data['extend_template'] = 'base_empty.html' if request.is_ajax() else 'base.html' return render(request, 'form.html', template_data) diff --git a/wger/nutrition/models.py b/wger/nutrition/models.py index a38d24d3f..68b64469d 100644 --- a/wger/nutrition/models.py +++ b/wger/nutrition/models.py @@ -92,7 +92,7 @@ class Meta: editable=False, on_delete=models.CASCADE) creation_date = models.DateField(_('Creation date'), auto_now_add=True) - description = models.CharField(max_length=(80), + description = models.CharField(max_length=80, blank=True, verbose_name=_('Description'), help_text=_('A description of the goal of the plan, e.g. ' diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py index 9ac8059d9..1ec56b227 100644 --- a/wger/utils/context_processor.py +++ b/wger/utils/context_processor.py @@ -71,6 +71,9 @@ def processor(request): # current gym, if available 'custom_header': get_custom_header(request), + + # Template to extend in forms, kinda ugly + 'extend_template': 'base_empty.html' if request.is_ajax() else 'base.html' } # Pseudo-intelligent navigation here diff --git a/wger/utils/generic_views.py b/wger/utils/generic_views.py index 80335961d..fdb15a5a1 100644 --- a/wger/utils/generic_views.py +++ b/wger/utils/generic_views.py @@ -165,10 +165,6 @@ def get_context_data(self, **kwargs): # Custom JS code on form (autocompleter, editor, etc.) context['custom_js'] = self.custom_js - # Template to extend. For AJAX requests we don't need the rest of the - # template, only the form - context['extend_template'] = 'base_empty.html' if self.request.is_ajax() else 'base.html' - return context def dispatch(self, request, *args, **kwargs): @@ -273,10 +269,6 @@ def get_context_data(self, **kwargs): # Additional delete message context['delete_message'] = self.delete_message_extra - # Template to extend. For AJAX requests we don't need the rest of the - # template, only the form - context['extend_template'] = 'base_empty.html' if self.request.is_ajax() else 'base.html' - return context def get_form(self, form_class=None):