def user_pages(user): """ Returns a treestructure containing only the pages the user can see. """ if user.has_module_perms('finch'): tree = Page.get_tree() else: tree = Page.get_tree().filter(online=True).distinct() return tree_info(tree)
def render(self, request): user = request.user if user.has_module_perms('finch'): tree = Page.get_tree() else: tree = Page.get_tree().filter(online=True) template = 'finch/dummy.html' return render_to_string('finch/sitemap.html', RequestContext(request, {'tree': tree, 'template': template}))
def sitemap(request): tree = Page.get_tree() if request.is_ajax(): template = 'finch/ajax.html' else: template = 'contentmanager/contentmanager_base.html' context = RequestContext(request, locals()) return render_to_response('finch/finch_sitemap.html', context)
def move_page(request, pageid): page = get_object_or_404(Page, id=pageid) tree = Page.get_tree() if request.is_ajax(): template = 'finch/ajax.html' else: template = 'contentmanager/contentmanager_base.html' context = RequestContext(request, locals()) return render_to_response('finch/move.html', context)
def handle_noargs(self, **options): from django.conf import settings from django.contrib.sites.models import Site from django.utils.translation import ugettext as _ from finch.models import Page from finch.settings import TEMPLATE_CHOICES home = Page.add_root(site_id=settings.SITE_ID, # default to the same as site_id, *could* # be different though... tree_id=settings.SITE_ID, title=_("Home"), slug="", created=datetime.now(), updated=datetime.now(), template=TEMPLATE_CHOICES[0][0], online=True) print _("Created a homepage")