need to write the html/css yourself. Because you say you want read only for
these fields, don't use the form field's rendering at all (or use a
hidden field).
Compose a div or span or whatever suits your fancy, and pass what you want
for content as a context variable (or possibly extract it from the
hidden field's
bound field object, I'd have to go look at the docs and maybe code). If you
want to choose between two constructs based on a complex evaluation of
the content, do it in python, in the view and pass it as a boolean in another
context variable to use in an if tag (or calculate in a model or form method
that is easy to call from the template code).
Or I may be totally misunderstanding the original problem.
Bill
On Wed, Sep 1, 2010 at 9:48 PM, bobhaugen <bob.haugen@gmail.com> wrote:
> On Sep 1, 12:17 pm, Bill Freeman <ke1g...@gmail.com> wrote:
>> This seems to me to be a job for the template. The forms documentation has
>> a section on custom rendering which shows you how to iterate through the
>> fields, or access them by name. You would insert whatever HTML construct
>> was appropriate for your text, providing a context variable giving its contents,
>> if necessary.
>
> I guess I do not understand your reply.
>
> I'm already iterating through the fields in the template, accessing
> them by name. Actually, many forms' worth of fields, in a many-rowed
> table. How would I display the product description for each row as
> flexibly-wrapped text, rather than as a field widget? That is what I
> am trying to do.
>
> Sorry if I am missing something that should have been obvious to me
> from "whatever HTML construct". Could you provide an example (or even
> another hint), that works with a formset?
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment