Change barcode field from integer to string

Updated the barcode field in FoodItem model and form from integer to string to support barcodes with leading zeros or non-numeric values. Added validation to ensure barcode contains only digits. Updated seed data to use string barcodes.
This commit is contained in:
2025-07-08 11:06:03 +02:00
parent 5b378cad38
commit bb5b2e8bc7
3 changed files with 6 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ class LoginForm(FlaskForm):
class FoodItemForm(FlaskForm):
barcode = IntegerField("Barcode", validators=[Optional()])
barcode = StringField("Barcode", validators=[Optional()])
name = StringField("Product Name", validators=[DataRequired()])
energy = IntegerField("Energy per 100g", validators=[InputRequired()])
protein = FloatField("protein per 100g", validators=[InputRequired()])