Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pptp/forms/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Meta:
'package_size',
'package_size_unit',
'is_supplemented_food',
'is_TDS',
'is_variety_pack',
'is_individually_packaged',
'has_preparation_instructions',
Expand Down Expand Up @@ -72,6 +73,7 @@ class Meta:
'class': 'form-select'
}),
'is_supplemented_food': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
'is_TDS': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
'is_variety_pack': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
'is_individually_packaged': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
'has_preparation_instructions': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.3 on 2025-10-21 15:28

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("pptp", "0014_product_has_disease_risk_reduction_claim_and_more"),
]

operations = [
migrations.AddField(
model_name="product",
name="is_TDS",
field=models.BooleanField(
default=False,
help_text="Check if this product is part of the Total Diet Study",
),
),
migrations.AlterField(
model_name="product",
name="is_supplemented_food",
field=models.BooleanField(
default=False,
help_text="Check if this is a Supplemented Food as defined by the regulations (whether or not it has a supplemental caution label)",
),
),
]
6 changes: 5 additions & 1 deletion pptp/models/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class Product(models.Model):
)
is_supplemented_food = models.BooleanField(
default=False,
help_text=_("Check if this is a Supplemented Food as indicated by the front-of-pack caution identifier and supplemented food facts table")
help_text=_("Check if this is a Supplemented Food as defined by the regulations (whether or not it has a supplemental caution label)")
)
is_TDS = models.BooleanField(
default=False,
help_text=_("Check if this product is part of the Total Diet Study")
)
is_individually_packaged = models.BooleanField(
default=False,
Expand Down
6 changes: 6 additions & 0 deletions pptp/templates/pptp/products/combined_upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ <h1 class="h3 mb-0">Product Submission</h1>
{{ form.is_supplemented_food.label }}
</label>
</div>
<div class="form-check">
{{ form.is_TDS }}
<label class="form-check-label" for="{{ form.is_TDS.id_for_label }}">
{{ form.is_TDS.label }}
</label>
</div>
</div>

<!-- Supplemented Food Flags Section -->
Expand Down
3 changes: 3 additions & 0 deletions pptp/templates/pptp/products/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ <h5 class="mb-1">{{ product.product_name }}</h5>
{% if product.is_supplemented_food %}
<span class="badge bg-secondary">{% trans "Supplemented Food" %}</span>
{% endif %}
{% if product.is_TDS %}
<span class="badge bg-secondary">{% trans "TDS" %}</span>
{% endif %}
</div>
</a>
{% empty %}
Expand Down
1 change: 1 addition & 0 deletions pptp/views/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def get_context_data(self, **kwargs):

context['variety_packs'] = user_products.filter(is_variety_pack=True).count()
context['supplemented_foods'] = user_products.filter(is_supplemented_food=True).count()
context['TDS'] = user_products.filter(is_TDS=True).count()

thirty_days_ago = timezone.now() - timedelta(days=30)
context['recent_products'] = user_products.filter(created_at__gte=thirty_days_ago).count()
Expand Down
Loading