Thursday, April 2, 2015

Re: best way to pass options to django views?

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/



On Thursday, April 2, 2015 at 9:35:39 PM UTC+3, dk wrote:
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 =)


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3d54b2c7-2423-473d-90f2-da47df4ccfb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment