pbs/django-cms-pagetags


Add page grouping capabilities to django-cms for easier page list management.

http://github.com/pbs/django-cms-pagetags

License: BSD-3-Clause

Language: Python


django-cms-pagetags

pagetags is a django-cms plugin that allows you to tag django-cms pages. With this functionality and corresponding templatetags in place you can group and list pages by their similarity, used tags and even create tag clouds. It works with django-tagging and django-tagging-ng and comes with autocomplete functionality.

Usage

This plugin is based on django-tagging application so it uses the TagInput to associate tags to a page.

In your settings.py add:

INSTALLED_APPS = (
    'tagging',
    'pagetags',
    ...
)

In your urls.py add:

urlpatterns += patterns('',
    url(r'^admin/tagging/autocomplete', include('pagetags.urls')),
    ...
)

To iterate over existing pages based on tags you can use this templatetags:

  • pages_with_tags: this templatetag takes tags as input strings and returns a list of pages that share the same tags. This result list can be ordered alphabetical or chronological using the optional order keyword and also limit the number of result using the optional limit keyword. The tags can be specified exactly as in TagInput field. Usage:

    {% pages_with_tags <"tag1, [tag2, tag3, ...]" | varname> [order chronological|alphabetical] [limit <int>] as <varname> %}
    
  • pages_similar_with: this templatetag takes a page slug as input and returns a list of pages that shares the same tags with the input page. This templatetag comes with a builtin ordering which will order the result pages after the number of shared tags in descending order. This result list can also be limited using the optional limit keyword. Usage:

    {% pages_similar_with <"pageslug" | varname> [limit <int>] as <varname> %}
    

Also checkout templatetags in documentation of django-tagging or django-tagging-ng.

Settings

Check django-tagging and django-tagging-ng documentation for details about configuration options.

Quick list for django-tagging:

  • FORCE_LOWERCASE_TAGS
  • MAX_TAG_LENGTH

Quick list for django-tagging-ng:

  • FORCE_LOWERCASE_TAGS
  • FORCE_TAG_DELIMITER
  • MAX_TAG_LENGTH
  • MULTILINGUAL_TAGS

Example

Templatetag usage:

{% load page_tags %}

{% pages_with_tags 'literature, painting' order alphabetical limit 10 as page_list %}
<ul>
    {% for page in page_list %}
        <li>{{ page }}</li>
    {% endfor %}
</ul>

{% pages_similar_with 'space_news' limit 5 as pagelist %}
<ul>
{% for page in pagelist %}
    <li>{{ page }}</li>
    {% endfor %}
</ul>

Project Statistics

Sourcerank 7
Repository Size 88.9 KB
Stars 19
Forks 8
Watchers 71
Open issues 2
Dependencies 2
Contributors 8
Tags 5
Created
Last updated
Last pushed

Top Contributors See all

Calin Furau Sever Băneșiu Bogdan Hodorog Andrei Horak gw0 Laura Feier pbsbamboo Zoltán Szeredi

Packages Referencing this Repo

django-cms-pagetags
Tag fileds for CMS pages. Works with django-tagging or django-tagging-ng.
Latest release 0.1.6 - Updated - 19 stars

Recent Tags See all

1.0.1 October 06, 2015
1.0.0 July 28, 2015
0.1.7 September 11, 2013
0.1.6 September 14, 2012
0.1.5 January 04, 2012

Interesting Forks See all

nephila/django-cms-pagetags
Add page grouping capabilities to django-cms for easier page list management.
Python - BSD-3-Clause - Updated - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2017-02-12 01:20:50 UTC

Login to resync this repository