small meal plan fixes
This commit is contained in:
parent
afa69c647d
commit
becdcdc6a4
@ -1,6 +1,5 @@
|
||||
from dal_select2.widgets import ModelSelect2
|
||||
from django import forms
|
||||
from django.forms import widgets, SelectDateWidget
|
||||
from django.forms import widgets
|
||||
from django.utils.translation import gettext as _
|
||||
from emoji_picker.widgets import EmojiPickerTextInput
|
||||
|
||||
@ -21,6 +20,10 @@ class MultiSelectWidget(widgets.SelectMultiple):
|
||||
class DateWidget(forms.DateInput):
|
||||
input_type = 'date'
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
kwargs["format"] = "%Y-%m-%d"
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class ExternalRecipeForm(forms.ModelForm):
|
||||
file_path = forms.CharField(disabled=True, required=False)
|
||||
|
@ -129,3 +129,6 @@ class MealPlan(models.Model):
|
||||
meal = models.CharField(choices=MEAL_TYPES, max_length=128, default=BREAKFAST)
|
||||
note = models.TextField(blank=True)
|
||||
date = models.DateField()
|
||||
|
||||
def __str__(self):
|
||||
return self.meal + ' (' + str(self.date) + ') ' + str(self.recipe)
|
||||
|
@ -42,6 +42,7 @@
|
||||
{% for day_key, days_value in plan_value.days.items %}
|
||||
<td>
|
||||
{% for mp in days_value %}
|
||||
<a href="{% url 'edit_plan' mp.pk %}"><i class="fas fa-edit"></i></a>
|
||||
<a href="#" onclick="openRecipe({{ mp.recipe.id }})">{{ mp.recipe.name }}</a><br/>
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user