Created
January 2, 2018 18:58
-
-
Save SamsadSajid/30b6a39109a5302127e02e6e2a88b8bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProductForm(forms.ModelForm): | |
product_id = forms.IntegerField( | |
widget=forms.TextInput(attrs={'class': 'form-control'}), | |
required=True | |
) | |
product_name = forms.CharField( | |
widget=forms.TextInput(attrs={'class': 'form-control'}), | |
max_length=100, | |
required=True) | |
product_image = forms.FileField( | |
widget=forms.FileInput(attrs={'class': 'form-control'}), | |
required=True | |
) | |
price = forms.DecimalField( | |
widget=forms.TextInput(attrs={'class': 'form-control'}), | |
required=True | |
) | |
quantity = forms.IntegerField( | |
widget=forms.TextInput(attrs={'class': 'form-control'}), | |
required=True | |
) | |
choice = (('available', 'available'), ('unavailable', 'unavailable')) | |
product_available = forms.ChoiceField(choices=choice) | |
product_porichiti = forms.CharField( | |
widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 3}), | |
max_length=100, | |
required=True) | |
product_description = forms.CharField( | |
widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 4}), | |
max_length=300, | |
required=True) | |
product_notes = forms.CharField( | |
widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 4}), | |
max_length=300, | |
required=True) | |
product_features = forms.CharField( | |
widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 4}), | |
max_length=300, | |
required=True) | |
class Meta: | |
model = ProductList | |
fields = ['product_id', 'product_name', 'product_image', 'price', 'quantity', 'product_available', | |
'product_porichiti', 'product_description', 'product_notes', 'product_features'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment