Skip to main content

To mask django url paths, instead of built in template tag

Project description

Build Downloads Latest Version Supported Python versions License

Masking url’s on templates not to show exact path, hiding them all except get params.

Installing

pip install django-maskurl

Then add <code>maskurl.middleware.UnMaskURLMiddleware</code> to the end of your <code>MIDDLEWARE_CLASSES</code>.

MIDDLEWARE_CLASSES = (
    'dikeyshop.syncer.middlewares.SyncerMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.http.ConditionalGetMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.doc.XViewMiddleware',
    ...
    'maskurl.middleware.UnMaskURLMiddleware',
  )

Usage

To mask a url on a template simply at the top, before all html codes <code>{% load maskurl %}</code> line must be placed, as following;

{% load maskurl %}
  <title>...
...

Then requested urls on that html file should be one of the following formats;

- {% url 'main' %}
- {% url 'list' 4 %}
- {% url 'list' 'blah' %}
- {% url 'list' object.id %}
- {% url 'list' obj1.id obj2.id %}
- {% url 'list' obj1.name|title obj2.id|lower %}
- {{ reversed_url }}

Those can be converted as following;

- {% maskurl 'main' %}
- {% maskurl 'main' 4 %}
- {% maskurl 'main' 'blah' %}
- {% maskurl 'main' object.id %}
- {% maskurl 'main' obj1.id obj2.id %}
- {% maskurl 'main' obj1.id|title obj2.id|lower %}
- {% maskurl reversed_url %}

get params can also be added after the closing curly bracket.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

django-maskurl-0.1.tar.gz (9.9 kB view details)

Uploaded Source

File details

Details for the file django-maskurl-0.1.tar.gz.

File metadata

File hashes

Hashes for django-maskurl-0.1.tar.gz
Algorithm Hash digest
SHA256 3a437590e53376f86f0cc44e0b37349bc0359faf85961c7113465158815fc5c8
MD5 6d891f7d2bd9cd82c2073c25c2eb5931
BLAKE2b-256 eb2656cfd13453211b8e47d5a2093c54808e520e158bd88baea63dd236836747

See more details on using hashes here.

Supported by

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