#25907: Alternative Way of Specifying URL Patterns
-----------------------------+--------------------
Reporter: srkunze | Owner: nobody
Type: New feature | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------
Other frameworks (like MVC 5) provide an inline-way of specifying the URL
pattern for a view.
Would it be possible to introduce such thing for Django?
Internally, we are working on something like this in order to accelerate
development and maintenance for our production system.
Manually looking up URLs in the url.py and then jump to the actual view
class is quite error-prone and tedious.
Internally, we evaluate two alternatives:
1) via class attribute: url
2) via decorator on class
{{{
# alternative 1
class ThingView(DetailView):
url = '/thing(?P<pk>\d+)'
template_name = 'thing.html'
# alternative 2
@url('/thing/(?P<pk>\d+)'):
class ThingView(DetailView):
template_name = 'thing.html'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25907>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.afb5d31e0330c82ba90c12319a2725be%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.