dark mode reverted + meal plan button

This commit is contained in:
vabene1111
2020-02-04 22:18:10 +01:00
parent c96159e15c
commit bc066d29f6
4 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,5 @@
import re
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
@ -126,4 +128,11 @@ class MealPlanCreate(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs):
context = super(MealPlanCreate, self).get_context_data(**kwargs)
context['title'] = _("Meal-Plan")
recipe = self.request.GET.get('recipe')
if recipe:
if re.match(r'^([0-9])+$', recipe):
if Recipe.objects.filter(pk=int(recipe)).exists():
context['default_recipe'] = Recipe.objects.get(pk=int(recipe))
return context