Re: Extending templates
On Tue, Sep 18, 2012 at 12:12 PM, Satinderpal Singhwrote: >> With template 'inheritance', when you extend another template, what >> happens is that the named blocks in the parent template are replaced >> with the equivalently named blocks in the derived template. >> >> This means that in the derived template, everything outside of a named >> block is ignored. You have lots of content outside the named blocks, >> so this is probably causing you some grief. >> > But I have used different block names for both the files. So I don't > think there is any chance of overriding of data. > You've misunderstood what I've said. This is your derived template, from an earlier post: {% extends "report/report_header.html" %} {% load i18n %} {% block content %} … {% endblock %} Since this is a derived template, ANYTHING outside of a {% block %} block is ignored. So that "\n", being outside of a block is ignored and not included in the result. I don't think this is what is causing your problem here though. Cheers Tom -- 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: Extending templates
On Tue, Sep 18, 2012 at 3:45 PM, Tom Evanswrote: > On Mon, Sep 17, 2012 at 8:14 AM, Satinderpal Singh > wrote: >> I want to extend a template file into the other file. I get fine >> results when done simply but whenever I use the template containing >> 'for' tag into the other, it does not show any results. >> My code for template which is to be extended is here : >> >> #template file to be extended into the other >> >> >> {% block header %} >> >> {% for organisations in organisation %} > > Is this just a logic fail? No, it is not the logic failure as the output is listed when file is not extended for other file. > Is 'organization' a list of organizations? > Or should this be 'for organization in organizations'? > No. The 'organization' is an object which calls the values from the database. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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: Extending templates
> With template 'inheritance', when you extend another template, what > happens is that the named blocks in the parent template are replaced > with the equivalently named blocks in the derived template. > > This means that in the derived template, everything outside of a named > block is ignored. You have lots of content outside the named blocks, > so this is probably causing you some grief. > But I have used different block names for both the files. So I don't think there is any chance of overriding of data. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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: Extending templates
On Mon, Sep 17, 2012 at 8:14 AM, Satinderpal Singhwrote: > I want to extend a template file into the other file. I get fine > results when done simply but whenever I use the template containing > 'for' tag into the other, it does not show any results. > My code for template which is to be extended is here : > > #template file to be extended into the other > > > {% block header %} > > {% for organisations in organisation %} Is this just a logic fail? Is 'organization' a list of organizations? Or should this be 'for organization in organizations'? Cheers Tom -- 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: Extending templates
On Mon, Sep 17, 2012 at 5:58 PM, Satinderpal Singhwrote: > On Mon, Sep 17, 2012 at 7:31 PM, jondykeman wrote: >> Can you put the code of the template you are extending this one with? > Here is the file that is extending: > > {% extends "report/report_header.html" %} > {% load i18n %} > > > {% block content %} > > With template 'inheritance', when you extend another template, what happens is that the named blocks in the parent template are replaced with the equivalently named blocks in the derived template. This means that in the derived template, everything outside of a named block is ignored. You have lots of content outside the named blocks, so this is probably causing you some grief. Hope that helps Tom -- 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: Extending templates
On Tue, Sep 18, 2012 at 9:45 AM, jondykemanwrote: > So the header for loop is the one that is not working? Yes, you are right. > Is organisation being fed to the view properly? Yes, it fed properly, as i checked it by making a template for the organisation view, it correctly fetch values from the database, the problem is only in extending the for loop to the other file. > If you put in {{ organisation }} in the section that is rendering properly > is it showing up as you expect? Yes, it shows proper results as expected. > > JD > > On Monday, September 17, 2012 10:59:16 AM UTC-6, Satinder Goraya wrote: >> >> On Mon, Sep 17, 2012 at 7:31 PM, jondykeman wrote: >> > Can you put the code of the template you are extending this one with? >> Here is the file that is extending: >> >> {% extends "report/report_header.html" %} >> {% load i18n %} >> >> >> {% block content %} >> >> >> >> Date of testing :> align="left">{{Date_of_testing}} >> >> >> Type of Structure:> align="left">{{Type_of_str}} >> >> >> Site location:> align="left">Latitude: {{Latitude_N}}Longitude: {{Longitude_E}} >> >> >> >> Tested in Presence of:> align="left">{{Presence_1}}, {{Presence_2}} >> >> >> Report Submitted to > align="left">{{Submitted_1}}, {{Submitted_2}}, >> {{Submitted_3}} >> >> >> >> >> >> >> {% endblock %} >> >> You can see full file at: >> http://202.164.53.122/~satinderpal/report_ok.html >> >> > What I would guess from what you said is that you might be using {% >> > block >> > head %} {% endblock %} in the other template that extends this one. >> No, i used {% block content %} {% end block %} for that >> >> > In that case you would override that for loop. If you want to add to the >> > head and also retain that for loop you will need to move the for outside >> > of >> > the block in the base template, but will be able to tell better once >> > seeing >> Here is the base file : >> http://202.164.53.122/~satinderpal/report_header.html >> > the other template's code. >> http://202.164.53.122/~satinderpal/report_ok.html >> > >> > JD >> > >> > On Monday, September 17, 2012 1:15:25 AM UTC-6, Satinder Goraya wrote: >> >> >> >> I want to extend a template file into the other file. I get fine >> >> results when done simply but whenever I use the template containing >> >> 'for' tag into the other, it does not show any results. >> >> My code for template which is to be extended is here : >> >> >> >> #template file to be extended into the other >> >> >> >> >> >> {% block header %} >> >> >> >> {% for organisations in organisation %} >> >> > >> >{{organisations.name}} >> >> {{organisations.address}} >> >> {% endfor %} >> >> >> >> >> >> {% endblock %} >> >> >> >> {% block content %}{% endblock %} >> >> >> >> Please see where I am going wrong. >> >> >> >> -- >> >> Satinderpal Singh >> >> http://satindergoraya.blogspot.in/ >> >> http://satindergoraya91.blogspot.in/ >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Django users" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/django-users/-/wTGigHz33vYJ. >> > To post to this group, send email to django...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/django-users?hl=en. >> >> >> >> -- >> Satinderpal Singh >> http://satindergoraya.blogspot.in/ >> http://satindergoraya91.blogspot.in/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/gF9AcKpbRWsJ. > > 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. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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: Extending templates
So the header for loop is the one that is not working? Is organisation being fed to the view properly? If you put in {{ organisation }} in the section that is rendering properly is it showing up as you expect? JD On Monday, September 17, 2012 10:59:16 AM UTC-6, Satinder Goraya wrote: > > On Mon, Sep 17, 2012 at 7:31 PM, jondykeman> wrote: > > Can you put the code of the template you are extending this one with? > Here is the file that is extending: > > {% extends "report/report_header.html" %} > {% load i18n %} > > > {% block content %} > > > > Date of testing : align="left">{{Date_of_testing}} > > > Type of Structure: align="left">{{Type_of_str}} > > > Site location: align="left">Latitude: {{Latitude_N}}Longitude: {{Longitude_E}} > > > > Tested in Presence of: align="left">{{Presence_1}}, {{Presence_2}} > > > Report Submitted to align="left">{{Submitted_1}}, {{Submitted_2}}, > {{Submitted_3}} > > > > > > > {% endblock %} > > You can see full file at: > http://202.164.53.122/~satinderpal/report_ok.html > > > What I would guess from what you said is that you might be using {% > block > > head %} {% endblock %} in the other template that extends this one. > No, i used {% block content %} {% end block %} for that > > > In that case you would override that for loop. If you want to add to the > > head and also retain that for loop you will need to move the for outside > of > > the block in the base template, but will be able to tell better once > seeing > Here is the base file : > http://202.164.53.122/~satinderpal/report_header.html > > the other template's code. > http://202.164.53.122/~satinderpal/report_ok.html > > > > JD > > > > On Monday, September 17, 2012 1:15:25 AM UTC-6, Satinder Goraya wrote: > >> > >> I want to extend a template file into the other file. I get fine > >> results when done simply but whenever I use the template containing > >> 'for' tag into the other, it does not show any results. > >> My code for template which is to be extended is here : > >> > >> #template file to be extended into the other > >> > >> > >> {% block header %} > >> > >> {% for organisations in organisation %} > >> >> >{{organisations.name}} > >> {{organisations.address}} > >> {% endfor %} > >> > >> > >> {% endblock %} > >> > >> {% block content %}{% endblock %} > >> > >> Please see where I am going wrong. > >> > >> -- > >> Satinderpal Singh > >> http://satindergoraya.blogspot.in/ > >> http://satindergoraya91.blogspot.in/ > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Django users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/django-users/-/wTGigHz33vYJ. > > To post to this group, send email to > > django...@googlegroups.com. > > > To unsubscribe from this group, send email to > > django-users...@googlegroups.com . > > For more options, visit this group at > > http://groups.google.com/group/django-users?hl=en. > > > > -- > Satinderpal Singh > http://satindergoraya.blogspot.in/ > http://satindergoraya91.blogspot.in/ > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/gF9AcKpbRWsJ. 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: Extending templates
On Mon, Sep 17, 2012 at 7:31 PM, jondykemanwrote: > Can you put the code of the template you are extending this one with? Here is the file that is extending: {% extends "report/report_header.html" %} {% load i18n %} {% block content %} Date of testing :{{Date_of_testing}} Type of Structure:{{Type_of_str}} Site location:Latitude: {{Latitude_N}}Longitude: {{Longitude_E}} Tested in Presence of:{{Presence_1}}, {{Presence_2}} Report Submitted to {{Submitted_1}}, {{Submitted_2}}, {{Submitted_3}} {% endblock %} You can see full file at: http://202.164.53.122/~satinderpal/report_ok.html > What I would guess from what you said is that you might be using {% block > head %} {% endblock %} in the other template that extends this one. No, i used {% block content %} {% end block %} for that > In that case you would override that for loop. If you want to add to the > head and also retain that for loop you will need to move the for outside of > the block in the base template, but will be able to tell better once seeing Here is the base file : http://202.164.53.122/~satinderpal/report_header.html > the other template's code. http://202.164.53.122/~satinderpal/report_ok.html > > JD > > On Monday, September 17, 2012 1:15:25 AM UTC-6, Satinder Goraya wrote: >> >> I want to extend a template file into the other file. I get fine >> results when done simply but whenever I use the template containing >> 'for' tag into the other, it does not show any results. >> My code for template which is to be extended is here : >> >> #template file to be extended into the other >> >> >> {% block header %} >> >> {% for organisations in organisation %} >> > >{{organisations.name}} >> {{organisations.address}} >> {% endfor %} >> >> >> {% endblock %} >> >> {% block content %}{% endblock %} >> >> Please see where I am going wrong. >> >> -- >> Satinderpal Singh >> http://satindergoraya.blogspot.in/ >> http://satindergoraya91.blogspot.in/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/wTGigHz33vYJ. > 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. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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: Extending templates
Can you put the code of the template you are extending this one with? What I would guess from what you said is that you might be using {% block head %} {% endblock %} in the other template that extends this one. In that case you would override that for loop. If you want to add to the head and also retain that for loop you will need to move the for outside of the block in the base template, but will be able to tell better once seeing the other template's code. JD On Monday, September 17, 2012 1:15:25 AM UTC-6, Satinder Goraya wrote: > > I want to extend a template file into the other file. I get fine > results when done simply but whenever I use the template containing > 'for' tag into the other, it does not show any results. > My code for template which is to be extended is here : > > #template file to be extended into the other > > > {% block header %} > > {% for organisations in organisation %} > >{{organisations.name}} > {{organisations.address}} > {% endfor %} > > > {% endblock %} > > {% block content %}{% endblock %} > > Please see where I am going wrong. > > -- > Satinderpal Singh > http://satindergoraya.blogspot.in/ > http://satindergoraya91.blogspot.in/ > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/wTGigHz33vYJ. 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.
Extending templates
I want to extend a template file into the other file. I get fine results when done simply but whenever I use the template containing 'for' tag into the other, it does not show any results. My code for template which is to be extended is here : #template file to be extended into the other {% block header %} {% for organisations in organisation %} {{organisations.name}} {{organisations.address}} {% endfor %} {% endblock %} {% block content %}{% endblock %} Please see where I am going wrong. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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: Extending templates in admin Django admin site question
Ok, I found it, {{ original.image }} :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Extending templates in admin Django admin site question
Hi, I want to extend default template for /admin/photosite/photo/some_id/. Basically, I want to display, only when editing, a thumbnail of the photo with JCrop widget for cropping. How can I access the 'image' field of the edited record? I think I need not to write a custom view here, since I only want to display some extra fancy markup. What I have so far: {% extends "admin/change_form.html" %} {% load i18n %} {% block after_field_sets %} {% if not add %} ... the image field should be printed here ... {% endif %} {% endblock %} Thanks in advance. Regards, Piotr --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---