0

Django forms are really easy and nice to style especially if you like to take control of the outcome.

A question. Is there anyway you can see whether the {{ field }} type, ie checkbox, radio etc?

2
  • It seems not (at least is not something in the field or in the widget classes). Can I ask you why you need this ? Commented Feb 3, 2011 at 13:59
  • @Tommaso, I just want to take style the way the the checkboxes look ie put them into columns etc, although there aren't that many, so I might just exclude it, from the {% for %} and hardcode them. Commented Feb 3, 2011 at 14:23

1 Answer 1

1

you could create a field_type template filter

{{ field|field_type }} = CharField 
{{ field|widget_type }} = TextInput

heres a great example :

http://olivergeorge.posterous.com/django-template-tags-to-find-out-field-type

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.