25 lines
782 B
Python
25 lines
782 B
Python
from django import forms
|
|
from django.core.exceptions import ValidationError
|
|
from manage_coupons.models import Coupon
|
|
|
|
|
|
class CouponForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Coupon
|
|
fields = [
|
|
"title",
|
|
"description",
|
|
# "image",
|
|
"discount_amount",
|
|
"discount_percentage",
|
|
"valid_from",
|
|
"valid_to",
|
|
"max_redeems",
|
|
]
|
|
widgets = {
|
|
"valid_from": forms.DateTimeInput(attrs={"type": "datetime-local"}),
|
|
"valid_to": forms.DateTimeInput(attrs={"type": "datetime-local"}),
|
|
# "discount_amount": forms.NumberInput(attrs={'step': '0.01'}),
|
|
# "discount_percentage": forms.NumberInput(attrs={'step': '0.01'}),
|
|
}
|