Skip to main content

Vue JS Reverse

Project description

================= VUE JS Reverse

Vue url handling for Django that doesn’t hurt.

Overview

Django Vue Reverse (a fork of Django Js Reverse) is a small django app that makes url handling of named urls <https://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns>__ in javascript easy and non-annoying..

For example you can retrieve a named url:

urls.py:

::

url(r'^/betterliving/(?P<category_slug>[-\w]+)/(?P<entry_pk>\d+)/$', 'get_house', name='betterliving_get_house'),

in javascript like:

::

this.$urls.betterlivingGetHouse('house', 12)

Result:

::

/betterliving/house/12/

Requirements

python 3.6+

Installation

Install using pip

::

pip install vue-js-reverse

… or clone the project from github.

::

git clone https://github.com/miklagard/vue-js-reverse

Add 'vue_js_reverse' to your INSTALLED_APPS setting.

::

INSTALLED_APPS = (
    ...
    'vue_js_reverse',
)

Add library variables to settings.py file.

::

VUE_PLUGINS_DIR = os.path.join(settings.BASE_DIR, 'vue_frontend', 'src', 'plugins')
VUE_REVERSE_URL_PLUGIN = 'Urls.js'

Vue main.js

::

 import Url from "@/plugins/Url"
 Vue.use(Url)

Usage as static file

First generate static file by

::

./manage.py vue_js_reverse

If you change some urls or add an app and want to update the reverse.js file, run the command again.

After this add the file to your template

License

MIT <https://raw.github.com/ierror/django-js-reverse/master/LICENSE>__

Contact

@i_error <https://twitter.com/i_error>__


Enjoy!

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

vue_js_reverse-0.0.4.tar.gz (17.8 kB view details)

Uploaded Source

File details

Details for the file vue_js_reverse-0.0.4.tar.gz.

File metadata

  • Download URL: vue_js_reverse-0.0.4.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for vue_js_reverse-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2be5b96ebdb151ffc799565f78862226a799a9580a444de2c3721d2909a3ec32
MD5 bc83300ef010829ddd51e14c1b6d0428
BLAKE2b-256 5831f8e502860c6c2fd966f8bd44367c9ffbd3621cb9f3c46a5a4f5461d841c2

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