django-link

Modeled link objects which include linking to objects, views and static urls.


License
BSD-3-Clause
Install
pip install django-link==0.1.1

Documentation

Django Link

Modeled link objects which include linking to objects, views and static urls.

https://travis-ci.org/praekelt/django-link.svg?branch=develop https://coveralls.io/repos/github/praekelt/django-link/badge.svg?branch=develop

Installation

  1. Install or add django-link to your Python path.
  2. Add link to your INSTALLED_APPS setting.
  3. Add url(r'^link/', include("link.urls", namespace="link")) to your url patterns (only required if you intend on using the list/detail views)

Note: django-link relies on "django.contrib.contenttypes" framework so this will need to be included in your INSTALLED_APPS setting.

Usage

django-link provides a model to add links to your projects. It provides a get_absolute_url method on the model which provides the url to either of these url types:

  1. Standard url string.
  2. Link to an object provided by the contenttype framework.
  3. Link to a pre-existing view with configurable view params.

To use include the link object in the context of your view and include the following code: {{ link.get_absolute_url }}

Or use the inclusion tag which has been provided: {% render_link slug %}

To exclude certain apps from the view name choice field add the namespace in your settings: LINK = {"excluded-viewname-choices": ["admin"]}

License

Please see the License requirements in the LICENSE file of this repository.