2022-01-16 16:13:59 +00:00
|
|
|
from django import forms
|
|
|
|
|
|
|
|
class ProductOrderForm(forms.Form):
|
2022-01-30 09:11:22 +00:00
|
|
|
product = forms.SlugField(required=True, disabled=True)
|
|
|
|
timeframe = forms.SlugField(required=True, disabled=True)
|
2022-01-16 16:13:59 +00:00
|
|
|
|
|
|
|
def __init__(self, resources, *args, **kwargs):
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
for res in resources:
|
|
|
|
print(res)
|
|
|
|
field_name = f"{res.name}"
|
|
|
|
#field_name = f"resource_{res.slug}"
|
|
|
|
self.fields[field_name] = forms.FloatField(required=True)
|