Skip to main content

We like writing short codes but we don"t want to think about logic. Here with django-arg-path package you can write short and clean code easily

Project description

This package helps you write shorter and cleaner codes by supporting the useage of one views with multiple urls in django. These urls and views are static but supports any extra dynamic slug, str, int etc.

Useage is simple

Here is our urls.py file

from django_arg_path import arg_path

urlpatterns = [
  arg_path('en', '', home, name='home_en',
  arg_path('ru', 'ru', home, name='home_ru',
  arg_path('es', 'es', home, name='home_es',
]

Here is our views.py file

def home(request, static_arg=''):
    # static_arg variable gives us en, ru and es as a string which we included in the beginning of our path
    return render(request, static_arg+'.html')

So this one views.py file creates 3 pages named '', 'ru' and 'es'

Something like that 127.0.0.1:8000/, 127.0.0.1:8000/ru, 127.0.0.1:8000/es,

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_arg_path-0.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file django_arg_path-0.2.tar.gz.

File metadata

  • Download URL: django_arg_path-0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for django_arg_path-0.2.tar.gz
Algorithm Hash digest
SHA256 9a6826314ecb34a4225f7bca10c390036b12e310ab455ecc8e7a7e577379dd52
MD5 8f131183651f71146c3df0528cba38b0
BLAKE2b-256 0e2c5ba81b0b25a2e778707259e496f509f7c99a7612ea5b5b65e24e3ab441c5

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