passing url variables to views

46 views
Skip to first unread message

dk

unread,
May 31, 2016, 5:33:59 AM5/31/16
to Django users
this is the URS i get


and i want to be able to get the string  ccc_ccc***a_b***

my url pattern is: 
url(r'^run_delete/(?P<user_del>\w+)/$', views.run_delete, name='run_delete')


but it looks like is not catching it,   i am missing something? i am using django 1.9

thanks guys

Mandeep Tondak

unread,
May 31, 2016, 5:43:32 AM5/31/16
to django...@googlegroups.com
Hey you are passing query string in url not an argument . i thing ur url should work as this

url(r'^run_delete/$', views.run_delete, name='run_delete')

and in your view

def  run_delete():
     if  request.GET.get('user_del'):



--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5c6c4fbe-836b-4f77-b5fe-64bdc382e35e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Warm Regard:-
Mandeep Kumar
     



dk

unread,
May 31, 2016, 1:13:03 PM5/31/16
to Django users
i was looking for something like this

the tutorial use d  for getting the number of the years,   =(     i am skipping a step?

Akhil Lawrence

unread,
May 31, 2016, 1:33:55 PM5/31/16
to Django users
Hi,

The URL you are calling is wrong.. 


No need to pass it as an query parameter.

dk

unread,
May 31, 2016, 5:03:29 PM5/31/16
to Django users
and then i can use it in the view? as an argument?

Akhil Lawrence

unread,
May 31, 2016, 11:18:14 PM5/31/16
to django...@googlegroups.com
Yeah

In your view you can access it by kwargs.get('user_del')



--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/kTYP0d5btHI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Lusine Hovsepyan

unread,
Jun 15, 2016, 8:54:21 AM6/15/16
to Django users
Hi dk.
If I understand well, you want to pass args from JS / HTML to  python view ?

Are you try url(r'^run_delete(.*)', views.run_delete, name='run_delete')   ?

Thanks

Lusine Hovsepyan

unread,
Jun 15, 2016, 8:54:21 AM6/15/16
to Django users
Hi dk.
If I understand well, you want to pass arg of JS / HTML to python view ?

Are you try url(r'^run_delete(.*)', views.run_delete, name='run_delete') ?

Thanks

вторник, 31 мая 2016 г., 13:33:59 UTC+4 пользователь dk написал:
Reply all
Reply to author
Forward
0 new messages