Hook
Hook

Reputation: 391

Django, creating a view with a link

i want to do a simple thing in django, ok, i have a view where i save all my data in a database, but that data is generated with a code, and that code its in a link, for example

127.0.0.1:8080/link/?code=ef713asd559q

i have this variable "url" that generate the url(mentioned before) with the code, i want to create a view where when you press a button and will go to the "url", then take that code and pass it as a parameter to the first view where i fill the database... if you guys dont understand please tell me, my english is not so good, so for me its a little hard to explain this, please dont be rough on me, some people in this comunity always answers me badly, and makes me feel bad... lol

thanks!

Upvotes: 0

Views: 138

Answers (1)

Raja Simon
Raja Simon

Reputation: 10305

You have the code then pass into url like

url(r'^link/?code=(?P<id>\d+)/$', 'save_link', name='save_link'),

then in your view

def save_link(request, id):
    pprint.pprint(id) # To check weather id's here or not!
    return HttpResponse('id 's here )

Upvotes: 1

Related Questions