From: "medhat" <medhat.ass...@gmail.com>
Date: Thu, 25 Jan 2007 16:45:21 -0800
Local: Thurs, Jan 25 2007 7:45 pm
Subject: A question related to URLConf, Reverse URL, etc...
Ok,
I have been thinking about this for about an hour now... and I would First, the problem that I was initially trying to solve: I have multiple models, all of which can be tagged. I also have a Tag And I have the following urls: /tags/x/ in the root urls.py (will return all items that both of these urls call the same view, but the second one will pass the In the final html will have a list of other tags that you can click. My problem is that the link for tag y in the second case should be At first this seemed like a good candidate for some Reverse URL def view_function(context,stem, .... ) where stem is the part of the I am willing to work on a patch that will implement this. But I also Another alternative, which I don't like as much, but will be backwards So, I would like to hear what you guys think. -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
From: "medhat" <medhat.ass...@gmail.com>
Date: Fri, 26 Jan 2007 10:12:32 -0800
Local: Fri, Jan 26 2007 1:12 pm
Subject: Re: A question related to URLConf, Reverse URL, etc...
Here is even a better idea...
in your urls.py when you "from django.conf.urls.defaults import *" this example: --- urls.py --- from django.conf.urls.defaults import * urlpatterns = patterns('', --- apps/tags/urls.py --- from django.conf.urls.defaults import * urlpatterns = patterns('apps.tags.views', --------------- In that case the url http://www.example.com/tags/x/ will call I already have a patch that does this. I don't have unit tests or -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
From: "medhat" <medhat.ass...@gmail.com>
Date: Fri, 26 Jan 2007 10:18:42 -0800
Local: Fri, Jan 26 2007 1:18 pm
Subject: Re: A question related to URLConf, Reverse URL, etc...
the url should be http://www.example.com/categories/x/
-- On Jan 26, 12:12 pm, "medhat" <medhat.ass...@gmail.com> wrote: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
From: "medhat" <medhat.ass...@gmail.com>
Date: Tue, 30 Jan 2007 08:33:02 -0800
Local: Tues, Jan 30 2007 11:33 am
Subject: Re: A question related to URLConf, Reverse URL, etc...
Well, I went ahead and created a patch for this. It is in ticket 3402
(http://code.djangoproject.com/ticket/3402) -- On Jan 26, 12:18 pm, "medhat" <medhat.ass...@gmail.com> wrote: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Date: Wed, 31 Jan 2007 06:02:20 -0800
Local: Wed, Jan 31 2007 9:02 am
Subject: Re: A question related to URLConf, Reverse URL, etc...
I actually wrote a patch yesterday to solve the same problem, but for
different reasons (and using a different method). From my perspective, the larger problem that access to the URL 'stem' can solve is to decouple apps from projects, making it much easier to write relocatable, "drop-in" applications. Currently, if an application wants to construct absolute URL's for The solution I went with was to add the stem transparently to the You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
From: "medhat" <medhat.ass...@gmail.com>
Date: Wed, 31 Jan 2007 07:56:26 -0800
Local: Wed, Jan 31 2007 10:56 am
Subject: Re: A question related to URLConf, Reverse URL, etc...
Well, Matt and Adrian closed the ticket with some similar argument.
But I respectfuly disagree :-) In muramas example above, (r'^news/', 'myproject.apps.news.urls', In the ticket the argument was that in the including urls.py you can 1. This will only work for one level of includes (granted I only have In my case, as I mentioned before, adding /tags at the end of almost My solution (the one in the patch in ticket 3402 is fully backward So, I would like you guys to reconsider the patch in light of this -- On Jan 31, 8:02 am, "mura...@gmail.com" <mura...@gmail.com> wrote: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Date: Wed, 31 Jan 2007 09:37:14 -0800
Local: Wed, Jan 31 2007 12:37 pm
Subject: Re: A question related to URLConf, Reverse URL, etc...
Ah, ok.. I understand a little better now what you are trying to do.
I definitely agree that a solution to this would be a useful addition; I would only advocate for considering the "request.stem" method instead. As with your patch, it is completely backwards-compatible and works with nested includes; I find it slightly more simple/ unintrusive, as you don't need to add anything to the URLconf in order to use the stem in a view. I haven't written docs/tests for the request.stem patch yet, but I can On Jan 31, 10:56 am, "medhat" <medhat.ass...@gmail.com> wrote: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
From: "SmileyChris" <smileych...@gmail.com>
Date: Fri, 26 Jan 2007 12:04:48 -0800
Local: Fri, Jan 26 2007 3:04 pm
Subject: Re: A question related to URLConf, Reverse URL, etc...
I'd suggest doing it as middleware which appends to the request (sorta
like the user middleware). This way it's available in the view as well as the template context (if you pass it explicitly or use the request context processor). Also, what about urls.py deeper than just parent->child? Maybe stem On Jan 27, 7:12 am, "medhat" <medhat.ass...@gmail.com> wrote: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
From: "medhat" <medhat.ass...@gmail.com>
Date: Fri, 26 Jan 2007 12:26:47 -0800
Local: Fri, Jan 26 2007 3:26 pm
Subject: Re: A question related to URLConf, Reverse URL, etc...
In the case of the parent->child->grandchild, the grandchild view will
get the stem for everything before the grandchild urls.py (In my case, I really did not care how many urls.py it went through, my main problem is that the same view can be called by multiple urls, and I wanted in each case to have the stem available to the template) As for doing it as a middleware, it is probably doable, but it does not On Jan 26, 2:04 pm, "SmileyChris" <smileych...@gmail.com> wrote: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2013 Google |