Get url parameters

27 views
Skip to first unread message

Hélio Miranda

unread,
May 15, 2013, 8:10:45 AM5/15/13
to django...@googlegroups.com
Hi

I need to get a parameter from the url and do not know how.
I did like this:  url(r'^view/(?P<id>\w+)', 'rest.views.view'),
And everything ok.

Now I have a url like this: http://localhost:8080/test/view/<GridFSProxy: 20519364e38774a71190edb28c>

With a url so, how can I get only the number (20519364e38774a71190edb28c)?

Someone can help me?

Sandro Dutra

unread,
May 15, 2013, 8:18:04 AM5/15/13
to django...@googlegroups.com
Your view is returning a GridFSProxy object, not a class/method
variable. You've to call a instance of your GridFSProxy, so you'll can
access the relative data.

2013/5/15 Hélio Miranda <heli...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Hélio Miranda

unread,
May 15, 2013, 8:25:36 AM5/15/13
to django...@googlegroups.com
So I mean the client side in my application I have to be able to access only the id, then just send the id and not <GridFSProxy: 519364e38774a71190edb28c>?

Could not sending as it is in django to extract just the number of the url?

Sandro Dutra

unread,
May 15, 2013, 3:52:58 PM5/15/13
to django...@googlegroups.com
gfsp = GridFSProxy()
gfsp.variable

Where variable is the variable name that contains the data storing the
number you want yo retrieve. I think it can solve your problem.

2013/5/15 Hélio Miranda <heli...@gmail.com>:

Hélio Miranda

unread,
May 20, 2013, 11:06:23 AM5/20/13
to django...@googlegroups.com
Hi

I need to get a parameter from the url which is the id and do not know how.
I do: url(r'^view/(?P<id>\w+)', 'rest.views.view'),
And everything ok.

Now I have a url like this: http://localhost:8080/test/view/<GridFSProxy:20519a3a6c8774a717dc59a84a>

With a url so, how can I get only the number (20519a3a6c8774a717dc59a84a)?
I'm trying this:
url(r'^view/.*Proxy:%(?P<id>\w+)%.*', 'rest.views.view'),

But it is giving, anyone know what I'm doing wrong?
Someone can help me?
Reply all
Reply to author
Forward
0 new messages