On Jan 3, 2006, at 8:52 AM, Dody Suria Wijaya wrote:
Alice wrote:
Is there a way of retrieving a database field's metadata? For example, the maxlength or choices parameters? It would be nice to automatically
display the number of allowed characters for a given textfield.

Hi Alice, try accessing via its class:

 Poll._meta.fields[2].maxlength

This is perhaps better spelled as::

  Poll._meta.get_field('choice').maxlength

However, be sure to note that (as the leading underscore indicates) ``_meta`` is semi-private and you should be prepared to accept possible future breakage if you use it.

Jacob

Reply via email to