Yes; Django says pretty much this same thing "on the tin":
"A view function, or *view* for short, is simply a Python function that
takes a Web request and returns a Web response." (
https://docs.djangoproject.com/en/dev/topics/http/views/
)
(I think there *is* magic in Django; but its in the i
Thanks, yes this is *exactly* what I'm after.
I'm coming from other web frameworks where there is more "magic" around
controllers/views so I was unsure about this solution, but in django it
appears that a view is explicity just a function that transforms a request
into a response.
Thanks again
You will want a routing view, or a fallback cascade. In either case, make
that urlpattern r'^([\w-]+)$'. You don't need to escape the - because it's
the last char in the class. You don want to restrict the urls to those in
which the entire url matches (^ and $), and the parentheses capture the
s
What do you mean by flat URL structure?
In any case you may have a controller called by the URL dispatcher that
decides which view to use to process the request.
No need to complicate on writing you own dispatcher replacement
On Tue, Jul 14, 2015, 4:20 PM Mathew Byrne
wrote:
> I have an applic
I have an application that requires a flat URL structure for multiple
different views. The single route r"^[\w\-]+" should start by looking at
slugs for one Model class, and move onto a Category Model class if no match
is found, then a Vendor model class, and lastly down to the flatpages app.
5 matches
Mail list logo