Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Question about including views in base templates [RSS Feed]

#1 Jan. 27, 2011 18:52:00

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Question about including views in base templates


Hello everyone,

I'm a while busy with coding in Django applications.
Now i have a question, because what I want to do,
doesn't work right.

if I request the url:http://localhost/shorts/I have a short template who gives me messages.
This template is loaded in a default template base.html.

Now i want that every time I extend the base.html
he needs to add default things, like a userlist in the right corner.
I have make there a view for. But now i want to load it.

When I do {% include "include/userlist.html" %} I thought he also
calls to the view.
But no he render only the view. So the information from the view will
not appear.

Does someone know a solution about this problem?

I'm looking forward for your answer.

Sincerely,

Michael

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 27, 2011 19:00:27

Shawn M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Question about including views in base templates


I think you're looking for context processors.http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processorsYou write functions that add to the context each page receives. That info is
available in the template regardless of which view called the rendering.

Shawn


--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 27, 2011 20:33:28

Mika J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Question about including views in base templates


I see now what you mean. I can really use that.
Thanks for the answer!

Michael

2011/1/27 Shawn Milochik <sh...@milochik.com>

> I think you're looking for context processors.
>
>
>http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors>
> You write functions that add to the context each page receives. That info
> is available in the template regardless of which view called the rendering.
>
> Shawn
>
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Question about including views in base templates [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support