Activity Not Available
0
I Use This!

Project Summary

Analyzed 3 months ago. based on code collected 3 months ago.

djwheel.app.decoratorsrender_to(template) decorator

this code

def my_view(request):
if some_condition():
return render_to_response('some_template.html',
{'var': var},
context_instance=RequestContext(request))
else:
return HttpResponseRedirect('/')is equal to

from djwheel.app.decorators import render_to

@render_to('some_template.html')
def my_view(request):
if some_condition():
return {'var': var}
else:
return HttpResponseRedirect('/')djwheel.app.contenttreeDjango-treemenus (http://code.google.com/p/django-treemenus/) fork.

settings.py options example:

TEMPLATE_CONTEXT_PROCESSORS = (
...
"django.core.context_processors.request",
...
)

INSTALLED_APPS = (
...
'djwheel.app.contenttree',
...
}
CONTENTTREE_DEFAULT_VIEW = 'mysite.views.default'urls.py:

....
urlpatterns = patterns('',
....
url(r'^', include('djwheel.app.contenttree.urls')),
....
)Code usage:

from djwheel.app.contenttree.core import get_content
@render_to('default.html')
def default(request):
return {
'contentpage': get_content(request.path),
}Template features:

{% load contenttree %}

{{ contentpage.get_title }}
{{ contentpage.content|safe }}

Draw menu:
{% show_menu "menu_name" %}

Draw top level menu items only:
{% show_top_menu "menu_name" %}

Draw 2nd and lower level items:
{% show_section_menu "menu_name" %}

Draw breadcrumbs based on pages in all site menus:
{% show_breadcrumbs %}
{% show_breadcrumbs "some title" %}

Second variant append "some title" as last non-active breadcrumbs elementdjwheel.app.templatetoolssettings.py:

INSTALLED_APPS = (
...
'djwheel.app.templatetools',
...
}1) formatfilters

{% load formatfilters %}

1) simple typograph:
{{ some_text|typo }}

2) human numeral:
{{ numeric_variable:"заяц|зайца|зайцев" }}
or
{{ numeric_variable:"%d заяц|%d зайца|%d зайцев" }}

3) wikiinline - bold, italic, links wiki markup:
{{ some_test|wikiinline }}

support:
**bold text**
//italic text//
((http://google.com Web Search))
[[http://google.com Web Search]]
2) navigation views.py:

from djwheel.app.templatetools.utils import get_pageitems

@render_to('list_page.html')
def show_list(request):
objects = SomeModel.objects.all()
return {'pageitems': get_pageitems(request, objects)}get_pageitems has optional parameters: page_var='page' perpage_var='perpage' default_perpage=30

list_page.html:

{% load navigation %}
{% for item in pageitems.object_list %}
{{ item }}
{% endfor %}
{% paginator pageitems %} 3) forms better that form.as_p / form.as_table. Draw "" for optional fields, css-customizable.

{% load forms %}

{% show_form form %}

Share

In a Nutshell, the-wheel-django-apps...

Languages

Languages?height=75&width=75
Python
90%
HTML
7%
4 Other
3%

Lines of Code

Activity

30 Day Summary

Apr 9 2016 — May 9 2016

12 Month Summary

May 9 2015 — May 9 2016

Community