adding food logging, phase 4
This commit is contained in:
+2
-1
@@ -6,7 +6,7 @@ from .models import FoodLogEntry, FoodProduct, MealType
|
||||
class ManualFoodForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = FoodProduct
|
||||
fields = ('product_name', 'brand', 'base_unit', 'energy_kcal_100', 'carbohydrates_100', 'protein_100', 'fat_100', 'fibre_100', 'sugars_100', 'salt_100')
|
||||
fields = ('product_name', 'brand', 'barcode', 'base_unit', 'energy_kcal_100', 'carbohydrates_100', 'protein_100', 'fat_100', 'fibre_100', 'sugars_100', 'salt_100')
|
||||
labels = {
|
||||
'energy_kcal_100': 'Calories per 100 g or ml',
|
||||
'carbohydrates_100': 'Carbohydrates per 100 g or ml',
|
||||
@@ -16,6 +16,7 @@ class ManualFoodForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['barcode'].required = False
|
||||
for field in ('energy_kcal_100', 'carbohydrates_100', 'protein_100', 'fat_100'):
|
||||
self.fields[field].required = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user