Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 16, 2005 14:56:41

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

admin/base_site.html


Hi all,

does anyone now how to use the {% block nav-global %} tag in
admin/base_site.html? I'm looking to get a nice main menu bar kinda'
thing like on the django site, but I'm not experienced (clever) enough
to figure it out.

/stava

Offline

#2 Nov. 16, 2005 15:04:44

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

admin/base_site.html


That's just a template block which you can fill in with your own contents (or rename or remove altogether if you choose).Django doesn't do any magic management of public site navigation (unless you use it to build an app that does).See this section of the template documentation for an overview of block tags and template inheritance:http://www.djangoproject.com/documentation/templates/#template-inheritanceCheers,WilsonOn 11/16/05,stava<> wrote:Hi all,does anyone now how to use the {% block nav-global %} tag inadmin/base_site.html? I'm looking to get a nice main menu bar kinda'thing like on the django site, but I'm not experienced (clever) enoughto figure it out./stava

Offline

#3 Nov. 16, 2005 15:56:30

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

admin/base_site.html


Thanks!
/stava

Offline

#4 Nov. 17, 2005 04:16:15

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

admin/base_site.html


On Wednesday 16 Nov 2005 8:26 pm, stava wrote:
> Hi all,
>
> does anyone now how to use the {% block nav-global %} tag in
> admin/base_site.html? I'm looking to get a nice main menu bar kinda'
> thing like on the django site, but I'm not experienced (clever)
> enough to figure it out.

this is what i do: in views:

menu_items =


def makemenu(item):
l = menu_items
for k in l:
k = ''
if k == item:
k = """ id="current" """
return l


def index(request):
t = template_loader.get_template('bamboos/index')
c = Context(request,
{
'mn': makemenu('Home'),
})

and in my base template:

<div id="navsite">

<h5>Site Navigation</h5>
<ul>
{% block navsite %}
{% for p in mn %}
<li >
<a href = "/mysite/{{ p.url }}" {{ p.id }}> {{ p.name }}
</a>
</li>
{% endfor %}

{% endblock %}
</ul>

</div>

this generates the menu and marks the correct current menu
--
regards
kghttp://www.livejournal.com/users/lawgontally ho!http://avsap.org.inಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

Offline

#5 Nov. 17, 2005 10:10:31

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

admin/base_site.html


Thanks a million, this is what I was looking for.
Cheers
/stava

Offline

Board footer

Moderator control

Enjoy the 20th of November
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