Skip to content

Commit 699a9f9

Browse files
committed
add batch selection option
1 parent 8810c35 commit 699a9f9

3 files changed

Lines changed: 24 additions & 16 deletions

File tree

pptp/forms/products.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ class Meta:
4040
'storage_condition',
4141
'primary_package_material',
4242
'secondary_package_material',
43-
'is_supplemented_food',
44-
'is_tds',
43+
'source_batch',
4544
'is_variety_pack',
4645
'is_individually_packaged',
4746
'has_preparation_instructions',
@@ -94,8 +93,9 @@ class Meta:
9493
'secondary_package_material': forms.Select(attrs={
9594
'class': 'form-select'
9695
}),
97-
'is_supplemented_food': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
98-
'is_tds': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
96+
'source_batch': forms.Select(attrs={
97+
'class': 'form-select'
98+
}),
9999
'is_variety_pack': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
100100
'is_individually_packaged': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
101101
'has_preparation_instructions': forms.CheckboxInput(attrs={'class': 'form-check-input'}),

pptp/models/products.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
("other", "Other"),
3838
]
3939

40+
BATCH_CHOICES = [
41+
("2025_snapcan","SNAP-CAN 2025"),
42+
("tds","Total Diet Study"),
43+
("2025_supp_food","2025 Supplemented Food Collection"),
44+
("2025_frozen_entrees","2025 Frozen Entrees Collection"),
45+
]
46+
4047

4148
def get_upload_path(instance, filename):
4249
model_name = instance.__class__.__name__.lower()
@@ -116,6 +123,12 @@ class Product(models.Model):
116123
help_text=_("Secondary packaging (optional)")
117124
)
118125

126+
source_batch = models.CharField(
127+
choices=BATCH_CHOICES,
128+
null=True,
129+
help_text=_("Product collection batch")
130+
)
131+
119132
num_units = models.IntegerField(blank=True, null=True, help_text=_("Number of individual units (optional)"))
120133

121134
is_variety_pack = models.BooleanField(

pptp/templates/pptp/products/combined_upload.html

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,14 @@ <h5 class="section-heading">Product Flags</h5>
148148
<div class="form-section">
149149
<h5 class="section-heading">Data Processing</h5>
150150

151-
<div class="form-check">
152-
{{ form.is_supplemented_food }}
153-
<label class="form-check-label" for="{{ form.is_supplemented_food.id_for_label }}">
154-
{{ form.is_supplemented_food.label }}
155-
</label>
156-
</div>
157-
158-
<div class="form-check">
159-
{{ form.is_tds }}
160-
<label class="form-check-label" for="{{ form.is_tds.id_for_label }}">
161-
Is part of Total Diet Study
162-
</label>
151+
<div style="margin-bottom: 10px;">
152+
<label for="{{ form.source_batch.id_for_label }}" class="form-label">Product Batch</label>
153+
{{ form.source_batch }}
154+
{% if form.source_batch.errors %}
155+
<div class="invalid-feedback d-block">{{ form.source_batch.errors.0 }}</div>
156+
{% endif %}
163157
</div>
158+
164159

165160
<div class="form-check">
166161
{{ form.needs_manual_verification }}

0 commit comments

Comments
 (0)