现在的位置: 首页 > 综合 > 正文

Pinax源代码分析5 – about

2013年10月23日 ⁄ 综合 ⁄ 共 1045字 ⁄ 字号 评论关闭

Pinax源代码分析5 - about

这个app比较简单,就是将一些url映射到几个html模板。

url

    (r'^about/', include('about.urls')),

urlpatterns = patterns('',
    url(r'^$', direct_to_template, {"template": "about/about.html"}, name="about"),
    
    url(r'^terms/$', direct_to_template, {"template": "about/terms.html"}, name="terms"),
    url(r'^privacy/$', direct_to_template, {"template": "about/privacy.html"}, name="privacy"),
    url(r'^dmca/$', direct_to_template, {"template": "about/dmca.html"}, name="dmca"),
    
    url(r'^what_next/$', direct_to_template, {"template": "about/what_next.html"}, name="what_next"),
)

来源

site_base.html 包含如下一段:

{% block footer %}
<div class="legal">
    {% trans "&copy; 2008 &lt;your company here&gt;" %}
    - <a href="{% url about %}">{% trans "About" %}</a>
    - <a href="{% url terms %}">{% trans "Terms of Service" %}</a>
    - <a href="{% url privacy %}">{% trans "Privacy Policy" %}</a>
    - <a href="{% url dmca %}">{% trans "DMCA Notice" %}</a>
    - Version: {% svn_app_version %}
    - Django: {% svn_app_version "django" %}
</div>
{% endblock %}

在注册完成之后,会被导向what_next

模板

what_next.html 存储在项目目录下的apps/about/ 子目录下,其它几个模板都存储在 lib pinax 子目录下,都是简单的html页面。

 Pinax what next页面截图

抱歉!评论已关闭.