best way to pass options to django views?

44 views
Skip to first unread message

dk

unread,
Apr 2, 2015, 2:35:39 PM4/2/15
to django...@googlegroups.com
I have a option section in my webpage just display the names of some machines

doing this tutorial I was able to get all the lines that appear in the "option" tag of my html.
and I can get a big string that I can separate by comas.

I was going to put that big long string as the last part of the url and use it with a get method such:

url:   mywebsite/myapp/?options=txt

def profile_page(request):
    options = request.GET.get("options", "")
    #here parse the options string
    
is this something recommended? or is a better smarter way?
thanks =)


Ilya Kazakevich

unread,
Apr 2, 2015, 8:17:19 PM4/2/15
to django...@googlegroups.com
This tutorial is about client-side (JavaScript) while Python/Django is server side:)

What are you trying to do? Pass all options from HTML page to server side? What for?
In most cases you want to pass the option selected by user to server. You must first read about HTML forms and how to submit them, and then read Django Forms tutorial: https://docs.djangoproject.com/en/1.8/topics/forms/

dk

unread,
Apr 3, 2015, 11:05:25 AM4/3/15
to django...@googlegroups.com
thanks,
I have 2 options and I made with java script buttons that can transfer the lines of one option to another 

now I want to pass all the lines of option2 to the server.
Reply all
Reply to author
Forward
0 new messages