django-simple-url allows developers to specify Django routes without having to learn the complicated intricacies of regular expressions, and is meant as a drop-in replacement of the native Django url function.
Usage
Using django-simple-url is almost the same as using the native Django url function.
# main/urls.py
from django_simple_url import simple_url
from . import views
urlpatterns = [
simple_url('', views.index),
simple_url('posts/<int:id>/', views.post),
]
It also works nicely with other apps, like for instance the Django Admin.
# main/urls.py
from django.contrib import admin
from django_simple_url import simple_url
urlpatterns = [
url('admin/', admin.site.urls),
]
Caveats
It should be noted that even though the type int appears in the syntax <int:post_id>, the value passed to the view is still a string. The int part of the syntax only limits the URLs that are matched, but does not alter the value passed to the view.
Inspiration
The development of this library is inspired by the following post on the Django mailing list: Challenge teaching Django to beginners: urls.py.
Metadata
Release files for django-simple-url 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-simple-url-0.0.1.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_simple_url-0.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 5.9 kB
Release files / django-simple-url-0.0.1.tar.gz
| Download URL | django-simple-url-0.0.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7c5baebdb5fa9fc1a21ac59db109775fb319d82a766092431965d7b9a8263c8
|
|
BLAKE2b-256 checksum How to use checksums |
d9e8b05b78894552761d531910ec1b877fb29d558ba4a2037de583dc4a0b35de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_simple_url-0.0.1-py2.py3-none-any.whl
| Download URL | django_simple_url-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
94fec2213ce813bb7e6bf9fdeb90cc7b90a63c4de0a4fab624b41ca7abde006e
|
|
BLAKE2b-256 checksum How to use checksums |
73b516202cccff6561168233651dcdf1444d5da59575f8e05f2d3f6ebc4d1e4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |