Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: Index page for an entire wiki #51

Open
puterleat opened this issue Sep 7, 2012 · 3 comments
Open

feature request: Index page for an entire wiki #51

puterleat opened this issue Sep 7, 2012 · 3 comments
Labels
enhancement A feature request: Will be implemented if someone steps up!

Comments

@puterleat
Copy link

Perhaps with the ability to specify a starting point in the tree, and a depth, and the ability to drill down the hierarchy as well as navigate to individual pages.

@benjaoming
Copy link
Member

That's a good idea... as well as RSS feeds would be great for updates and to monitor when new pages arrive.

Both cases have to account for permissions, though.

@puterleat
Copy link
Author

That's a good idea... as well as RSS feeds would be great for updates and to monitor when new pages arrive.

Both cases have to account for permissions, though.

Will django's sitemap framework be useful? I'm not sure in this case... but a sitemap config would be nice to have too.

@jdcaballerov
Copy link
Contributor

Hello, I have one dirty solution I've been using during debug to get the index for a user and (almost) respecting permissions . Thanks to Ben for the excellent architecture !
I am not sure about all drawbacks of my implementation.

I create a view as follows:

from wiki import models


def wiki_index(request,template='wiki_index.html'):
    #hope this line circumvents any site issues
    nodes = models.URLPath.root().get_descendants(include_self=True).can_read(request.user) 
    if not request.user.has_perm('wiki.moderate'):
        nodes = nodes.exclude(article__current_revision__deleted=True)  

return render_to_response(template,{'nodes':nodes},context_instance=RequestContext(request))

and then using mptt tags is straightforward (wiki_index.html)

{% load mptt_tags %}
{% load url from future %}

<ul>
    {% recursetree nodes %}
        <li>
        <a href="{% url 'wiki:get' path=node.path %}"> {{node.article.current_revision.title|default_if_none:"No Title"}}</a>
            {% if not node.is_leaf_node %}
                <ul class="children">
                    {{ children }}
                </ul>
            {% endif %}
        </li>
    {% endrecursetree %}
</ul> 

urls.py add

 url('^index/$', 'your_app.views.wiki_index', name='wiki_index'),

This code "almost" respects permissions, since taking into account the current implementation (not architecture) of can_moderate it is wiki wide and not per article.

Any advise on how to fully implement it correctly ? I dont want to test each article for can_moderate, and since the manager doesn't implement it I dont see any better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature request: Will be implemented if someone steps up!
Projects
None yet
Development

No branches or pull requests

3 participants