This document covers various components of pinax.apps.blog.
This setting is used to control how many items in a feed. Defaults to 20:
PINAX_ITEMS_PER_FEED = 50
A list of markup choices to make available in the blog. Defaults to an empty list. Available choices are: [("restructuredtext", u"reStructuredText"), ("textile", u"Textile"), ("markdown", u"Markdown"), ("creole", u"Creole")]
The actual origin of this setting is django-wikiapp which is one of the external applications Pinax integrates. pinax.apps.blog uses it to determine, how a post’s content should be converted from plain text to HTML.
MARKUP_CHOICES = [("textile", "Textile"), ("markdown", "Markdown")]
Using this option you can pass additional settings as dictionary through the restructuredtext template library to the underlying docutils.core.publish_parts function. Defaults to empty dict.
RESTRUCTUREDTEXT_FILTER_SETTINGS = {}
the users’ real IP addresses are stored when they create blog posts. When activated the blog takes the user’s IP address from request.META['HTTP_X_FORWARDED_FOR'] instead of request.META['REMOTE_ADDR']. Defaults to False.
BEHIND_PROXY = True
The named urls in this app should enable the use of of the {% url %} template tag as well as reverse lookups in your project code without having to know the implementation details of this app.
Render a template with a specific blog post entry in context.
keyword arguments: | |
---|---|
(?P<username>[-\w]+)/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+) |
Render a template with a queryset in context of all blog posts.
Renders a template with a queryset in context of blog posts that are owned by a specified username.
keyword arguments: | |
---|---|
The username to list blog posts for matching (?P<username>\w+). |
Renders a template with a queryset in context of blog posts that are owned by the logged in user.
A GET request renders a template with a form instance in context. A POST request processes the data from this form and redirects user to blog_list_yours.
Upon a GET request a form is rendered to edit the blog entry. This urls also will process the POST request from submitting the form. After updating the post the response will be redirected to blog_list_yours.
arguments: | The id for the blog post that matches (\d+). |
---|
Delete a blog post that is yours on POST requests. Otherwise, it redirects the user to blog_list_yours.
arguments: | The id for the blog post that matches (\d+). |
---|
Uses the ajax_validation app, it validates the blog post with the pinax.apps.blog.forms.BlogForm.
Templates should be placed in an blog/ folder at the root of one of your template search paths.
context: | blogs |
---|
context: | post |
---|
context: | blogs |
---|
context: | blog_form |
---|
context: | blog_form, post |
---|
A model which holds a single post.
Provides the creole template filter, to render texts using the markup used by the MoinMoin wiki.
Render the ReStructuredText into html. Will pre-render template code first.
Example:
{% restructuredtext %}
===================================
To: {{ send_to }}
===================================
{% include "email_form.rst" %}
{% endrestructuredtext %}
The core content of the restructuredtext flatpage with history, editing, etc. for use in your “flatpages/default.html” or custom template.
Example:
<html><head><title>{{ flatpage.title }}</title></head>
<body>{% load restructuredtext %}{% rstflatpage %}</body>
</html>
This will inject one of 6 different page contents:
Simplistic switch/case tag for Django.
Usage:
{% load switchcase %}
{% switch meal %}
{% case "spam" %}...{% endcase %}
{% case "eggs" %}...{% endcase %}
{% endswitch %}
Switch tag. Usage:
{% switch meal %}
{% case "spam" %}...{% endcase %}
{% case "eggs" %}...{% endcase %}
{% endswitch %}
Note that {% case %} arguments can be variables if you like (as can switch arguments, buts that’s a bit silly).