mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-29 19:00:00 +00:00
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:
2
forms.py
2
forms.py
@@ -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()])
|
||||
|
||||
Reference in New Issue
Block a user