15 lines
830 B
Python
15 lines
830 B
Python
from django import forms
|
|
from .models import Item, Category
|
|
|
|
class ItemForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Item
|
|
fields = ['name', 'category', 'image', 'item_type', 'tags']
|
|
widgets = {
|
|
'name': forms.TextInput(attrs={'class': 'form-control bg-dark text-white border-secondary', 'placeholder': 'Item Name'}),
|
|
'category': forms.Select(attrs={'class': 'form-select bg-dark text-white border-secondary'}),
|
|
'item_type': forms.Select(attrs={'class': 'form-select bg-dark text-white border-secondary'}),
|
|
'tags': forms.TextInput(attrs={'class': 'form-control bg-dark text-white border-secondary', 'placeholder': 'Tags (comma-separated)'}),
|
|
'image': forms.FileInput(attrs={'class': 'form-control bg-dark text-white border-secondary'}),
|
|
}
|