Skip to main content

Django JS Urls: urlpatterns for clientside

Project description

Django JS Utils [![Build Status](https://travis-ci.org/mixman/django-js-utils.svg?branch=master)](https://travis-ci.org/mixman/django-js-utils)
===============

A fork of dutils, a library for using Django urlpatterns on the clientside.

Installation
------------

1. Add `django_js_utils` to INSTALLED_APPS

2. Set the file to hold the generated urls
```URLS_JS_GENERATED_FILE = 'static/js/dutils.conf.urls.js'```

3. Add inclusion/exclusions patterns
```
URLS_INCLUDE_PREFIX = ['^api',]
URLS_INCLUDE_PATTERN = ['index','status']
URLS_EXCLUDE_PREFIX = ['^internal',]
URLS_EXCLUDE_PATTERN = ['index',]
```

4. Add to your project:
```
<script type="text/javascript" src="{{STATIC_URL}}dutils.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}dutils.conf.urls.js"></script>
```

Usage
-----

1. Create the `URLS_JS_GENERATED_FILE` (for production remember to run `collectstatic`):
```
python manage.py js_urls
```

2. Clientside Django urlpatterns:
```
url('time_edit', {'project_id': 1, time_id: 2}
url('time_edit', [1, 2])
```

Credits
-------

Credit contributing to django-js-utils goes to:
* Marco Louro (author)
* Chris Reeves
* Dimitri Gnidash
* Luke Zapart
* Robby Dermody
* Antti Kaihola
* Simon Williams
* Jussi Vaihia

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-js-utils-nextgen-0.9.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file django-js-utils-nextgen-0.9.0.tar.gz.

File metadata

File hashes

Hashes for django-js-utils-nextgen-0.9.0.tar.gz
Algorithm Hash digest
SHA256 23ab92935efb48986b5fd8d6483fd4b713be528f8ded2d8ef232129ea7e3b82a
MD5 c34a4107debec9035d5ac61fb9e28cbc
BLAKE2b-256 5f61d34f72175989c0cf83e62dfa6d42f851a6f3205be4dd5b8b687d8db2dacb

See more details on using hashes here.

Supported by

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