Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6743915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:01:17+00:00 2026-05-26T12:01:17+00:00

I have annoying problems using django-sitetree (version 0.5.1) for generating a navigation menu with

  • 0

I have annoying problems using django-sitetree (version 0.5.1) for generating a navigation menu with Django. For testing purposes I tried to configure django-sitetree to make a sitetree for the “Polls” app (official Django tutorial). I configured it according to some instructions answering a prior question – but i ran into trouble using url patterns, which didn’t work for me.

So these are my url patterns for “Polls”, which are included in /polls (I don’t use trailing slashes):

urlpatterns = patterns('polls.views',
    (r'^$', 'index'),
    (r'^/(?P<poll_id>\d+)$', 'detail'),
    (r'^/(?P<poll_id>\d+)/results$', 'results'),
    (r'^/(?P<poll_id>\d+)/vote$', 'vote'),
)

I only configured the views index and detail like this via Django admin:

Title                        URL
My site                      /
+ Polls                      polls.views.index
  + Poll {{ poll.question }  polls.views.detail poll.id

Which produces the following output using {% sitetree_menu from "maintree" include "trunk" %} on my main page /

Title                        URL
My site                      /
+ Polls                      /polls
  + Poll                     #unresolved

But what I am expecting is:

Title                        URL
My site                      /
+ Polls                      /polls
  + Poll foo                 /polls/1
  + Poll Test #2             /polls/2

I have already tried several things like using named views in the urls.py (as recommended in the documentation), but i don’t even get a simple {% sitetree_url %} working with parameters. It’s a pity to see that there’s nothing helpful on the web except some copies of the answer mentioned above. I would appreciate it if anyone helped me out with a more detailed one. Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:01:18+00:00Added an answer on May 26, 2026 at 12:01 pm

    Currently there is no way for the application to meet your expectations, i.e. it can’t figure out how many polls you have described by “Poll {{ poll.question }” of yours, and which of them you want to show in the menu.

    I should try to think this feature over, but frankly speaking, I do not consider placing dozens of polls in the menu a good idea.

    Nevertheless, there are several ways you can cope with it:

    1. Create entries for each poll you need manually;

    2. Add poll entry to the tree when new poll is created, e.g. using signals and model’s API. As you can see, it is the same as option 1, but automatized;

    3. Do not show “Poll {{ poll.question }” in the menu and sitetree, but only in breadcrumbs. Thus considering “Polls” page for navigation through polls list. In case of breadcrumbs “Poll {{ poll.question }” will be resolved into full title when on pool’s page according to given rules.


    For hardyharzen, who asks in the comments for an example on no.2:

    • You can read about signals at https://docs.djangoproject.com/en/1.3/topics/signals/.

    • Django built-in signals we will use are described at https://docs.djangoproject.com/en/1.3/ref/signals/.

    Suppose we are still talking about polls. Put the following code in polls app models.py file.

    Note that this code adds tree item into site tree with id 1, at tree branch with id 10, and expects Poll model to have get_absolute_url() method defined.

    from django.db.models.signals import post_save  
    from django.dispatch import receiver  
    from sitetree.models import TreeItem
    

    –

    @receiver(post_save, sender=Poll)
    def on_poll_add(instance, created, **kwargs)
        if created:
            tree_item = TreeItem(title=instance.title, tree_id=1, 
                parent_id=10, url=instance.get_absolute_url())  
            tree_item.save(force_insert=True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using gnu Make 3.82 and have an annoying problem. I have a
I've recently started using GNU Screen but have run into a very annoying problem.
Hey guys, I have another really annoying problem in IE. I am using a
I have an annoying problem when using machine learning library PyML . PyML uses
I have a really annoying intermittent issue when loading a series of assets using
I have a annoying problem .. I want my first 4 items in a
I have an annoying problem with the debug mode of Visual C++ 2005. My
i have this annoying problem with my site where, when you click on a
XML is cool in flex, but I have an annoying problem to solve, caused
I've recently begun learning C# but have encountered an annoying problem. Every variable I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.