All Projects → Visgean → Urljects

Visgean / Urljects

Licence: bsd-3-clause
Deprecated! (Django routing without urls.py files, inspired by Flask.)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Urljects

Django Macros Url
Django Macros URL. Routing must be simple as possible
Stars: ✭ 121 (+128.3%)
Mutual labels:  django, router
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-1.89%)
Mutual labels:  django
Hubblemon
Stars: ✭ 48 (-9.43%)
Mutual labels:  django
Grocerystore With Server
Grocery Store with server integration
Stars: ✭ 51 (-3.77%)
Mutual labels:  django
Spirit
Spirit is a modern Python based forum built on top of Django framework
Stars: ✭ 1,045 (+1871.7%)
Mutual labels:  django
Django Campaign
Newsletter management app for Django
Stars: ✭ 50 (-5.66%)
Mutual labels:  django
Wolframwebengineforpython
Integrates the Wolfram Language seamlessly with Python AIOHTTP
Stars: ✭ 48 (-9.43%)
Mutual labels:  django
Hyper Router
Simple routing middleware for rust HTTP library hyper.
Stars: ✭ 51 (-3.77%)
Mutual labels:  router
Django Dashboard Adminlte
AdminLTE Django - Open-source seed project | AppSeed
Stars: ✭ 51 (-3.77%)
Mutual labels:  django
Disposableemailchecker
Python class for use with Django to detect Disposable Emails
Stars: ✭ 50 (-5.66%)
Mutual labels:  django
Yesterday I Learned
Brainfarts are caused by the rupturing of the cerebral sphincter.
Stars: ✭ 50 (-5.66%)
Mutual labels:  django
Flowzard
Isolates navigation from UI and Business logic with simple wizard like mechanism.
Stars: ✭ 49 (-7.55%)
Mutual labels:  router
Django Money
Money fields for Django forms and models.
Stars: ✭ 1,064 (+1907.55%)
Mutual labels:  django
Django Todolist
exemplary django application - small to do list web app
Stars: ✭ 47 (-11.32%)
Mutual labels:  django
Django Custom User Model
django custom user model
Stars: ✭ 52 (-1.89%)
Mutual labels:  django
Django Celery Tutorial
Django Celery Tutorial
Stars: ✭ 48 (-9.43%)
Mutual labels:  django
Django Unifi Portal
Authenticate Unifi WiFi Guests with Django
Stars: ✭ 50 (-5.66%)
Mutual labels:  django
Urfairy
C# extensions for Unity development
Stars: ✭ 51 (-3.77%)
Mutual labels:  extensions
Channelstream
Channelstream is a websocket communication server for web applications
Stars: ✭ 52 (-1.89%)
Mutual labels:  django
Django Rest Framework Tricks
Collection of various tricks for Django REST framework.
Stars: ✭ 52 (-1.89%)
Mutual labels:  django

URLjects - project no longer maintained

Since Django 2.0 introduced new system of routing I dont think kind of approach is desired anymore.

Travis CL Documentation Status Pypi Code Health Requirements Status Coverage Status

Library which greatly simplifies django urls definition! And as a side effect it makes translated urls amazingly easy. Just compare

# old urls notation
url('^detail/(?<slug>[\w-]+)', MyDetailView.as_view(), name='detail')
# easified !even translated! notation
url(U / _('detail') / slug, MyDetailView, name='detail')

Getting rid of urls.py

With the use of include_view() you can avoid urls.py and include your app's views directly in root urls.py.

    from urljects import view_include
    # inside your root urls.py
    urlpatterns = [
        # old style
        url("myapp/", include("myapp.urls")),
        # new urljects style
        url("myapp/", view_include("myapp.views"))
    ]

Soo how to put urls directly into views?

I am glad you asked! For class based views simply inherit from URLView and add name and url as their attributes.

from urljects import URLView, U, slug
from django.views.generic import DetailView

class ItemDetail(URLView, DetailView):
    name = 'detail'
    url = U / 'detail' / slug

A lot of people enjoy functional views, for those there is url_view decorator.

from urljects import url_view

@url_view(U / 'category' / rest)
def detail(request, rest)
    ...

After that you can user view_include instead of creating urls.py and then old-style include them afterwards.

I want to keep my urls.py

Quite often you need some urls.py - for example your root urls. Then you can use patterns like slug or rest as shown above inside your urls.py. We even provide modified url function to strip away the boilerplate of .as_view(),

from urljects import U, slug, url

url_patterns = (
    url(U / 'detail' / slug, view=DetailView),
    # instead of
    url(r'^detail/(?P<slug>[\w-]+)' , view=DetailView.as_view(),
        name='detail'),
)

The name of the view has been taken from DetailView.url_name. There are also some common regular patterns like slugs and UUIDs so that you can focus on more important stuff than on debugging regular expressions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].