Note that url pattern's aren't required to have names, so you can't capture
statistics on unnamed urls patterns in apps that you want to use unmodified.

If, on the other hand, you just want to collect statistics on url patters which
are "under your control", and thus can be required to have names, you can
add a copy of the name (or whatever token you like) to the extra context.
You could even make it less painful by providing your own implementation
of url that does it for you, either with a different name, which you apply to
the patterns of interest, or to the whole file by importing your version as
url.  You must be sure that all the views in question are prepared for the
extra context.

Bill

On Tue, Nov 24, 2009 at 5:48 AM, bcurtu <bcu...@gmail.com> wrote:
> No, I don't.
>
> I want to know the name of the url for a given url pattern. So, when I
> get in my method the url someone is asking for (next='/people/'), I
> want to know the name of the url that identifies this pattern
> (people_name). It's not for a HttpRedirect, it's for statistical
> porpouses.
>
> It's something like resolve, but not reverse.
>
> Thanks
>
> On 24 nov, 11:15, rebus_ <r.dav...@gmail.com> wrote:
>> 2009/11/24 bcurtu <bcu...@gmail.com>:
>>
>>
>>
>> > Hi,
>>
>> > I want to get the url name from a url. For example, having:
>>
>> >    url(
>> >        regex   = r'^people/$',
>> >        view    = 'people_view',
>> >        name    = 'people_name'
>> >        ),
>>
>> > and
>>
>> > @login_required
>> > def people_view(request)...
>> >     _some_code_here...
>>
>> > I'm looking for a function that accepts "people/" and returns
>> > "people_name". I have tried to use django.core.urlresolvers.resolve,
>> > however it returns a wrapper fuction for login_required.
>>
>> > Is it posible?
>>
>> > --
>>
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>>
>> Usually what you want to do is:
>>
>> from django.core.urlresolvers import reverse
>> reverse('people_name')
>>
>> http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse
>>
>> I don't see why you need url name, i think the name is meant to be
>> used to resolve urls not other way around.
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to