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..

You can retrieve a named url:

urls.py:

path('company/update/company_id/<int:company_id>/', main.update_company, name='update_company')

in javascript like:

this.$urls.update_company(12)

Result:

company/update/company_id/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.githubusercontent.com/miklagard/vue-js-reverse/master/LICENSE

Contact

cem.yildiz@ya.ru


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.1.0.tar.gz (17.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: vue_js_reverse-0.1.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for vue_js_reverse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e8e8d53c9d67d5f6afe805558f5c42f816fbe50e52e9ae990dfaa6d67686f968
MD5 0d643d84d6bcd2c9fe1248b321635637
BLAKE2b-256 9ac3832ceb2322b05ec707763917e2e9240c7dd65067c0c5e8f75e1c8cb08c14

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