Allow editing more fields in the ingredient form

This commit is contained in:
Roland Geider
2025-06-20 19:07:46 +02:00
parent 0d16a954e9
commit aa66ec5d5f

View File

@@ -19,15 +19,6 @@ import logging
from datetime import datetime
from decimal import Decimal
# Django
from django import forms
from django.forms import BooleanField
from django.urls import reverse
from django.utils.translation import (
gettext as _,
gettext_lazy,
)
# Third Party
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (
@@ -38,6 +29,14 @@ from crispy_forms.layout import (
Row,
Submit,
)
# Django
from django import forms
from django.forms import BooleanField
from django.urls import reverse
from django.utils.translation import (
gettext as _,
gettext_lazy,
)
# wger
from wger.core.models import UserProfile
@@ -49,7 +48,6 @@ from wger.nutrition.models import (
)
from wger.utils.widgets import Html5NumberInput
logger = logging.getLogger(__name__)
@@ -335,6 +333,7 @@ class IngredientForm(forms.ModelForm):
fields = [
'name',
'brand',
'code',
'energy',
'protein',
'carbohydrates',
@@ -345,6 +344,8 @@ class IngredientForm(forms.ModelForm):
'sodium',
'license',
'license_author',
'source_name',
'source_url',
]
widgets = {'category': forms.TextInput}
@@ -357,6 +358,7 @@ class IngredientForm(forms.ModelForm):
Column('brand', css_class='col-6'),
css_class='form-row',
),
'code',
'energy',
'protein',
Row(
@@ -371,9 +373,11 @@ class IngredientForm(forms.ModelForm):
),
'fiber',
'sodium',
'license',
'license_author',
Row(
Column('license', css_class='col-6'),
Column('license_author', css_class='col-6'),
Column('source_name', css_class='col-6'),
Column('source_url', css_class='col-6'),
css_class='form-row',
),
)