On Mon, 2009-02-09 at 21:14 -0800, Margie wrote:
> I have a model that contains a 'created' field where 'editable' is set
> to False in the model.
> 
> I'd like to display the created field in my form, but not allow it to
> be modified.  I tried putting it in
> the include list for the form, but that didn't seem to have any affect
> (it didn't display in the form).
> 
> Is there a way to do this in a form or do I need to simply put the
> created field into my template separate from the display of the form?

You could create a form Field subclass that only displays the data and
never validates it or inserts it into cleaned_data for the form. In
other words, a kind of read-only for field. There are a few details that
would have to be sorted out, but it sounds eminently possible if you
were going to do this a lot. One day we'll eventually add support for
read-only items in the admin and we'll have to invent something like
that for those, I suspect.

On the other hand, I've always just inserted it directly into the form
template when I've had this kind of situation.

Regards,
Malcolm



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

Reply via email to