Hello,

I am new to Django. I tried experimenting with create_update generic
view, exploring the template tags, especially concerning widgets.

 From my reading of the documentation, within the
<lowercase_model_name>_form.html is passed the model form (either
passed in, or the framework create one), and therefore, the model
fields are accessible, and can be used as tags.  QUESTION: How about
the attributes of the field?

If I use widget, it works nicely. That is, the attribute 'max_length'
is properly rendered as maxlength.

However,  if the tags try access to attributes within the model
fields, it does *not* work for all attributes, except label.

Can I be enlighten on :Is this the right approach ?  Are tags like
{{ form.title.max_length }} is syntactically correct?

___ model.py ___

class Example(models.Model):
        """An Example"""
        title = models.CharField(blank=True, max_length=30)

___ example_form.html ___

<form action ="" method="POST" name="exampleForm"
Title: {{ form.title }}
<input type="submit" name="submit" value="Example" id="submit">
</form>

<br>
This is OKAY:  {{ form.title.label }} :
<br>
This is NOT okay: {{ form.title.max_length }}
<br>

===

p/s: usefulness :  explore doing sway with widgets, and exploring
using some kind of javascript ui library, extracting attributes like
max_length as arguments to javascript function call).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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