8 ms·
I also did my own URL routing ... http://code.google.com/p/django-catalyst/ http://code.google.com/p/django-catalyst/ I copied the chained actions model from C
by bad_user 17y ago
I also did my own URL routing ...
http://code.google.com/p/django-catalyst/ http://code.google.com/p/django-catalyst/
I copied the chained actions model from Catalyst, and the routing is automatically generated. I also have template tags defined that construct these URLs for me (not uploaded in the repository).
I structure my views in a structure like ...
views/root.py
views/articles.py
views/users.py
views.root contains a "begin" method, that will be chained to all other requests. If views.articles needs users to be authenticated, I also add a "begin" view to views.articles (where I do the authorization required). So as an example, a chain could look like this ...
views.root.begin -> views.articles.begin -> views.articles.item -> views.articles.show
This is really far from the way things are done in Django, but it seems more intuitive to me.
What I find cool about Django is that the dispatching is really simple to understand, and it can be extended (and components aren't hard to replace in general).