Skip to main content

A collection of random Django utilities

Project description

Django Muckraking
=================

A collection of various Django utilities. It includes:


Middleware
----------

:code:`muckraking.middleware.SpacelessMiddleware`
Removes spaces and line breaks between html tags. Leaves <script> blocks intact


:code:`muckraking.middleware.LegacyURLRedirectMiddleware`
An apache-like approach to redirects.

Specify your redirects in settings.py like this::

LEGACY_URL_REDIRECTS = (
(r'^/about/news-events\.php(.+)?', '/news-events/$1',),
(r'^/about/(?!index\.php)', '/about/',),
)


Template Context Processors
---------------------------

:code:`muckraking.template.context_processors.debug_context`
Add a :code:`{{ DEBUG }}` variable Django templates. The value is a boolean


Standard Template Tags
----------------------

To use the following tags, add :code:`{% load muckraking_tags %}` to your template.

:code:`{% git_commit_hash %}`
Outputs the commit hash of the HEAD commit in a git repo. Useful for cache-busting strings


Django CMS Template Tags
------------------------

To use the following tags, add :code:`{% load muckraking_cms_tags %}` to your template.

:code:`{% page_url_by_slug "foobar-page" %}`
Allows you to perform reverse lookups on pages by slug::


Management Commands
-------------------

import_redirects
Allows you to import a csv file of redirect urls into the redicet app::

./manage.py import_redirects ~/path/to/redirects.csv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-muckraking-0.2.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file django-muckraking-0.2.tar.gz.

File metadata

File hashes

Hashes for django-muckraking-0.2.tar.gz
Algorithm Hash digest
SHA256 c681432c4c430ec7fdaed5c11185f78b9274c6487ebc0680d02dce28ead1dbfc
MD5 66ee2c43155766160648a2a162e76bae
BLAKE2b-256 73e3cca7045d8ab5da40559b10862d0be9b9c7cefc7bca66ee71c3e90f910def

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page