Hello group,

I'm reasonably new to Django andconfused over how to implement generic
views for CRUD operations, specifically with respect to newforms. I'm
using 0.96 for the time being, but I'm happy to upgrade to the
development version if required.

What I'm trying to acheive is an automatic way of rendering a form to
create/update etc. a model. I know this is possible because the admin
site does it!

I understand how the URLconf part of things work, but I'm not sure
what to put in the template to actually render the form.

For completeness, my URLconf contains this line:

> (r'^job/new/$',         create_object, {'model': Job, 'template_name': 
> 'newjob.html'}),

and my (very simplistic) template contains this:

> {% block content %}
> <p>Fill in this form:</p>
> {{form}}
> {% endblock %}

I had hoped that some magic would turn {{form}} into an HTML rendered
form, but all it does it output the __str__ method of FormWrapper.

If I use {{form.field}}, then the field is correctly rendered in the
HTML - but it seems stupidly repetitive to have to manually rebuild
forms in the template using {{form.field}} for every field. So my
first question is: how can this be done automatically?

Secondly, am I shooting myself in the foot here by using elements of
oldforms which will be canned in the next stable release? And if so,
are there any resources out there on how to do this the 'right' way?

Many thanks indeed,
Matt.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to