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 import forms
|
||||||
from django.forms import widgets, SelectDateWidget
|
from django.forms import widgets
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from emoji_picker.widgets import EmojiPickerTextInput
|
from emoji_picker.widgets import EmojiPickerTextInput
|
||||||
|
|
||||||
@ -21,6 +20,10 @@ class MultiSelectWidget(widgets.SelectMultiple):
|
|||||||
class DateWidget(forms.DateInput):
|
class DateWidget(forms.DateInput):
|
||||||
input_type = 'date'
|
input_type = 'date'
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
kwargs["format"] = "%Y-%m-%d"
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
class ExternalRecipeForm(forms.ModelForm):
|
class ExternalRecipeForm(forms.ModelForm):
|
||||||
file_path = forms.CharField(disabled=True, required=False)
|
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)
|
meal = models.CharField(choices=MEAL_TYPES, max_length=128, default=BREAKFAST)
|
||||||
note = models.TextField(blank=True)
|
note = models.TextField(blank=True)
|
||||||
date = models.DateField()
|
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 %}
|
{% for day_key, days_value in plan_value.days.items %}
|
||||||
<td>
|
<td>
|
||||||
{% for mp in days_value %}
|
{% 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/>
|
<a href="#" onclick="openRecipe({{ mp.recipe.id }})">{{ mp.recipe.name }}</a><br/>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user