from django import forms from django.utils.translation import gettext_lazy as _ from .models import Listing, Bid, Comment class ListingForm(forms.ModelForm): class Meta: model = Listing fields = ('title', 'description', 'start_bid', 'image', 'category') labels = { 'title': _('Title: '), 'description': _('Description: '), 'start_bid': _('Starting Bid: '), 'image': _('Image URL: '), 'category': _('Cateogry: ') } class BidForm(forms.ModelForm): class Meta: model = Bid fields = ('bid',) labels = { 'bid': _('Bid'), } class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ('comment',) labels = { 'comment': _('Comment') } widgets = { 'comment': forms.Textarea(attrs={'cols': 70, 'rows': 5,}) }