>How would you do this in Django?
Well,in Django I have the following "url patterns" defined:

urlpatterns = patterns('',
     #list of post -> URL : /
     (r'^$','mydjangoproj.blog.views.index'),
     #post detail -> URL:
     (r'^(?P<post_id>[0-9]+)/$','mydjangoproj.blog.views.detail'),
     ....
)

in mydjangoproj.blog.views I have two functions index() and
detail(post_id) defined to handle the request. As you can see, the
request to URL like

/blog/1

would be passed to function detail(post_id), and the ID of requested
post (1) would be captured as the argument of detail(post_id). Quite
handy.

In the template,I can use url tag to generate the path:

{% url mydjangoproj.blog.views.detail 1 %}

>I've heard that Django uses regular
>expression syntax for routing, and that's the biggest thing Django
>people miss when they use Routes.  Would you say that's the case?
Well , I have to say I am kinda missing it. It is highly configurable.

On Jan 12, 7:12 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote:
> On Jan 12, 2008 1:22 AM, MurphyTalk <[EMAIL PROTECTED]> wrote:
>
>
>
> > By using your way it works just fine ;) Thank you Mike!
> > BTW, the named routes are much more clearer indeed.
>
> Thanks.  Now I have a question for you.  How would you do this in
> Django?  How does Routes differ from the Django dispatcher as a Django
> person would see it?  As you may know, I'm coordinating an upgrade to
> Routes, so I'm curious about any feedback which may lead to its
> improvement.  For instance, I've heard that Django uses regular
> expression syntax for routing, and that's the biggest thing Django
> people miss when they use Routes.  Would you say that's the case?
>
> --
> Mike Orr <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to