Closed GoogleCodeExporter closed 8 years ago
Hi,
I believe the problem here is actually that you need to put quotes around testw
when calling the menu tag.
Without the quotes it's attempting to resolve a variable with that name (which
will still draw a menu if it
resolves to be a MenuGroup object) and not finding it.
There is still a bug here as it should most likely just fail silently like most
other template related stuff does
when you don't have a variable with that name (although it wouldn't have made
it as easy to discover this
issue).
I'll also make a note to make sure I explain this properly when I come to
writing up the documentation fully.
__
G
Original comment by greatlemer@gmail.com
on 8 Aug 2009 at 7:38
Hi,
After appending quotes the template renders fine, but still there are no menu.
Tag
fails silently, but why? I specified correct MenuGroup name.
Original comment by and...@polyakov.name
on 9 Aug 2009 at 6:33
Hi,
I tried creating a few different menu systems on my test setup and things
seemed to be working ok for
me (django 1.1 on OS X). There are however a handful of situations where
nothing will show up when
using the menu template tag and you may wish to check these:
1. A basic one I'm afraid but if the group name is wrong then it won't show.
The name is case sensitive
so that should be checked;
2. There are some menu options in the group that have their parent set to be
none (these are the root
elements of the menu);
3. Out of the root elements on display the permission criteria for them to be
seen are met;
4. Out of the root elements on display if the Sites app is installed there must
be some with the current
site set to be active;
5. If the root elements consist only of model menu options then the query for
one of those needs to return
something.
Currently if there are anything else wrong it should raise some sort of
exception. Let me know if any of
these were the problem and if none of them are I'll look at adding a setting
which will enable some debug
logging.
--
G
Original comment by greatlemer@gmail.com
on 11 Aug 2009 at 7:55
I got an error, menu_as_ul does not fails silently.
Original comment by and...@polyakov.name
on 12 Aug 2009 at 2:56
Attachments:
Ah I've experienced that one before. Basically it's down to the fact that
either you do not have
django.core.context_processors.request included in your
TEMPLATE_CONTEXT_PROCESSORS setting
or you haven't rendered the template with a RequestContext.
Original comment by greatlemer@gmail.com
on 12 Aug 2009 at 4:04
I am rendering template with RequestContext like this:
return render_to_response(template, data,
context_instance=RequestContext(request))
And I have the following TEMPLATE_CONTEXT_PROCESSORS in settings:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'petauction.requestmessages.context_processors.messages',
)
I can't figure out whats wrong.
Original comment by and...@polyakov.name
on 12 Aug 2009 at 5:35
But when I specify the wrong group name it fails silently.
Original comment by and...@polyakov.name
on 12 Aug 2009 at 5:39
Hi,
Looking at the list of context processors that you are using, that would appear
to be where things are going
wrong. As I mentioned in comment 5, you need to add
'django.core.context_processors.request' to your list
of TEMPLATE_CONTEXT_PROCESSORS.
This is because the menu system needs to look at the request object when it's
trying to calculate if the
current user (if any should be allowed to see the menu).
--
G
Original comment by greatlemer@gmail.com
on 13 Aug 2009 at 5:58
I added this django.core.context_processors.request to
TEMPLATE_CONTEXT_PROCESSORS.
I attached page from my admin, there is a menu structure.
I have Sites app installed, I checked all from third comment, but I have no
elements
rendered. Could you give some working example or tut?
Original comment by and...@polyakov.name
on 13 Aug 2009 at 8:44
Attachments:
Hmmm... looking over the file you uploaded, there's nothing instantly obvious
as to why this isn't showing up.
With regards to a tutorial I would suggest trying something very simple.
Create a new MenuGroup and then
add just one MenuOption to it, make that MenuOption an absolute URL one and
point it to google or any site
of your choice really, then make sure that for the sites setting you highlight
all of them, that you do not select
a parent option and that under the permissions group you have all the "show to"
options checked. Finally
make sure that you have nothing selected in the 'chose permissions' box.
Now put this MenuGroup into a template and you should definitely see something
this time. If so then try
gradually changing all the non-url related settings so that it resembles either
the Sale or bids_all options
(which look to be your root options from the uploaded file). If at any point
during the changes it stops
showing up then let me know what the cause was. If it gets all the way to the
point that the only difference is
one's a named url type and one isn't then also let me know.
--
G
Original comment by greatlemer@gmail.com
on 18 Aug 2009 at 7:04
Thank you, it's help me, but I see only the first level, I tried many
combanations,
what is a stumbling block?
I think you should restrict setting of parent item to itself and parent to
child,
etc.
Off top: I noticed that tick images in menu tree are not available because it's
name
is translated, it means: http://127.0.0.1:8000/media/img/admin/icon-да.gif
instead
of http://127.0.0.1:8000/media/img/admin/icon-yes.gif
Original comment by and...@polyakov.name
on 18 Aug 2009 at 4:25
Closing this off as it's been lingering for ages now. If there's still an
issue here then let me know.
The image path translation should be fixed now.
Original comment by greatlemer@gmail.com
on 9 Mar 2011 at 7:45
Original issue reported on code.google.com by
and...@polyakov.name
on 8 Aug 2009 at 7:25Attachments: