Re: customizing admin template - how to refer to specific field
This has been put in the "too hard" basket for now. I'm upgrading from django 0.96 to 1.0.2 and was hoping to make this custom view a configured admin view but am leaving that till later now as it's taking too much time away from porting the rest of the system. On Jul 21, 11:43 am, sicowrote: > Yeah, that will do it, but it will get cumbersome quite quickly... I'm > thinking if I override the change_view and add_view functions on the > admin model I can set the fieldsets variable however I like! > > My system is down at the moment so I can't test it... does that sound > like it will work? I'll report back as soon as I can test it > > On Jul 21, 11:32 am, Joshua Russo wrote: > > > On Mon, Jul 20, 2009 at 10:26 PM,sico wrote: > > > > 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 > > > I think you want to look at the different IF tags > > here:http://docs.djangoproject.com/en/dev/ref/templates/builtins/ --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: customizing admin template - how to refer to specific field
Yeah, that will do it, but it will get cumbersome quite quickly... I'm thinking if I override the change_view and add_view functions on the admin model I can set the fieldsets variable however I like! My system is down at the moment so I can't test it... does that sound like it will work? I'll report back as soon as I can test it On Jul 21, 11:32 am, Joshua Russowrote: > On Mon, Jul 20, 2009 at 10:26 PM, sico wrote: > > > 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 > > I think you want to look at the different IF tags > here:http://docs.djangoproject.com/en/dev/ref/templates/builtins/ --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: customizing admin template - how to refer to specific field
On Mon, Jul 20, 2009 at 10:26 PM, sicowrote: > > 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 I think you want to look at the different IF tags here: http://docs.djangoproject.com/en/dev/ref/templates/builtins/ --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: customizing admin template - how to refer to specific field
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, rajeeshwrote: > On Jul 20, 9:38 am, sico wrote: > > > > > Its quite simple to customize the admin template for a specific model > > by creating a change_form.html in the templates/admin// > > / 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}} > > {{field.last_name.label}} {{ field.last_name.field}} > > Why not? If you've got a form with fields first_name & last_name, you > may render it by hand as follows: > > {{ form.first_name.label_tag }}{{ form.first_name }} > {{ form.last_name.label_tag }}{{ form.last_name }} --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: customizing admin template - how to refer to specific field
On Jul 20, 9:38 am, sicowrote: > Its quite simple to customize the admin template for a specific model > by creating a change_form.html in the templates/admin// > / 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}} > {{field.last_name.label}} {{ field.last_name.field}} > Why not? If you've got a form with fields first_name & last_name, you may render it by hand as follows: {{ form.first_name.label_tag }}{{ form.first_name }} {{ form.last_name.label_tag }}{{ form.last_name }} --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
customizing admin template - how to refer to specific field
Its quite simple to customize the admin template for a specific model by creating a change_form.html in the templates/admin// / directory. But, is it possible to refer to particular fields in the model/form directly? E.g. 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}} {{field.last_name.label}} {{ field.last_name.field}} etc... ?? thanks --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---