¡@

Home 

python Programming Glossary: productform

Change the width of form elements created with ModelForm in Django

http://stackoverflow.com/questions/110378/change-the-width-of-form-elements-created-with-modelform-in-django

used ModelForm to create it Here is my product class class ProductForm ModelForm long_desc forms.CharField widget forms.Textarea short_desc.. fields through CSS. Example for long_desc field in your ProductForm when your form does not have a custom prefix #id_long_desc width.. is to pass attrs keyword to your widget constructor. class ProductForm ModelForm long_desc forms.CharField widget forms.Textarea attrs..

Using Django time/date widgets in custom form

http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form

Product from django.contrib.admin import widgets class ProductForm forms.ModelForm class Meta model Product def __init__ self args.. Meta model Product def __init__ self args kwargs super ProductForm self .__init__ args kwargs self.fields 'mydate' .widget widgets.AdminDateWidget.. Change your URLconf to pass 'form_class' ProductForm instead of 'model' Product to the generic create_object view..