Version 4 (modified by pmasiar, 14 years ago) (diff)


FormGen Script

Maybe this is obsolete too: ModelForms is simpler way to do it? Or if not, why is FormGen better?

Since newforms will replace manipulators and produce forms for inclusion in templates there is no need for the Scaffold Script? any more.

The attached script will turn the model below into the Form below for use as a basis in your own application.


class Category(models.Model):
    category = models.CharField(maxlength=50, unique=True)
    createdOn = models.DateField(auto_now_add=True)
    modifiedOn = models.DateField(auto_now=True)
    test = models.ManyToManyField(auth.User, verbose_name='This is a test field', related_name='test')
    test2 = models.OneToOneField(auth.User, verbose_name='test2', related_name='test2')


class CategoryForm(forms.Form):
    category = forms.CharField()
    createdon = forms.DateField()
    modifiedon = forms.DateField()
    test2 = forms.ChoiceField()
    this_is_a_test_field = forms.MultipleChoiceField()

Attachments (3)

Download all attachments as: .zip

Back to Top