> Interestingly, I wanted to write very similar request, but you passed
> ahead of me. :) I'm writing form/questionnaire site for our summer
> school and I want to be able render filled forms as text, easy readable
> and easy printable. So, my needs are pretty close to yours.

It struck me as not very DRY (Don't Repeat Yourself) to define two
templates to set out the details of a record where the only real
difference is that in one the field values are editable and the other
they're not (or in some cases where some fields become uneditable and
just have their values shown), and it's messy to put the logic into
the template to alternatively render the value or the field widget.

> My thought was to define two views for each form - one for editing
> and one for viewing filled forms. In latter case in constructor I planned
> to replace all widgets with some "label" widget, which would render
> its value as raw (probably formatted) text.

It's a little easier to work with how django currently does things if
the whole form is to be shown in read mode rather than just part of it
as you can just override the widgets - if you still want some fields
to be editable you hit the issue of django's default form save
processing/validation expecting that if a field exists on the form
then it will have a value submitted!

My current approach to do something that works for me without having
to change django is a slightly messy mix of a my own ModelForm
subclass and my own template tags that get passed the field so the
template tag is what renders the field either as a widget or just as a
display value as appropriate. Obviously I'd prefer something like I
outlined in my previous post!

Regards,
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