I have a feeling this is orthogonal to the original request.
The original request/problem was "regex is hard".
Your response answers/solves "the URL definition is somewhere different from the view definition".
Both issues are realistic [1], and orthogonal.
[1]: I myself have great aversion to the approach where URL patterns are spread out over the codebase, but I know others are greatly prefer the approach that Flask takes.
On Sep 29, 2016 8:11 PM, "Sven R. Kunze" <srku...@gmail.com> wrote:
--Hi Emil,that's not only a teaching issue. Also experienced devs struggle with this way to declaring URLs.Internally, we developed a UrlMixin for our view classes such as:class MyView(UrlMixin, View):url_pattern = r'^bar/foo/$'view_name = 'my-index'# rest of view codeThat's all we need to do in order to define a view with a working url pattern.Reverse works with the optional view_name or by reversing the class itself.Maybe, the simplification of your proposal could be explored by providing such a UrlMixin first.Best,Sven
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/20a1c1c5-8d5c-49f7-b770-880b7f231798%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b2d0882f-219b-4e3a-aa33-636c1872d783%40email.android.com.
For more options, visit https://groups.google.com/d/optout.