thats cool to know, but not quite what I'm after I don't think. If there was a simple way to display the label, field and any errors all at once would be nice otherwise it gets quite cumbersome to be repeating that all each time.
Basically what I want to be able to do is to show different fields depending on a data value.... e.g. if field1 = 1 then hide field7 else hide field8 On Jul 20, 11:47 pm, rajeesh <[email protected]> wrote: > On Jul 20, 9:38 am, sico <[email protected]> wrote: > > > > > Its quite simple to customize the admin template for a specific model > > by creating a change_form.html in the templates/admin/<app_name>/ > > <model>/ directory. > > > But, is it possible to refer to particular fields in the model/form > > directly? > > > Instead of using the loops: > > for fieldset in adminform: > > for line in fieldset: > > for field in line: > > .... > > > doing something like: > > > {{field.first_name.label}} {{ field.first_name.field}}<br/> > > {{field.last_name.label}} {{ field.last_name.field}}<br/> > > Why not? If you've got a form with fields first_name & last_name, you > may render it by hand as follows: > > <div>{{ form.first_name.label_tag }}{{ form.first_name }}</div> > <div>{{ form.last_name.label_tag }}{{ form.last_name }}</div> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

