pass variable value store in dictionary to url parameter

2014-07-28 Thread pattinson


I pass dict

addon_id_value_mapping = 
  {'menu': '1', 'opening_hour': '2', 'books': '3', 'doctors': '4'}

and

addon_list = [{u'menu': [{u'price': 50, u'name': u'Momo', u'price_level': 
u'cheap'},
 {u'price': 510, u'name': u'potato', u'price_level': 
u'expensive'},
 {u'price': 100, u'name': u'Chowmein', u'price_level': 
u'expensive'}]},
  {u'opening_hour': [{u'close': 17, u'open': 9, u'day': 0}, 
 {u'close': 17, u'open': 9, u'day': 1},
 {u'close': 16, u'open': 8, u'day': 2}]}]

from view to django-template. I can access the value of the dict using 
template-tags 

 to 
display but I couldn't able to pass in url field. What should I need to do 
to pass variable value that store in dict in url parameter

{% if addon_list %}

{% for addon_name in addon_list %}
{% for key, values in addon_name.iteritems %}



{{ key }}{# title- menu #}





update

{#todo #}





{% for value in values %}
{% for k,v in value.iteritems %}

{{ k }}
{{ v }}

{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}{% endif %}

I'm using Django 1.6.5

-- 
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+unsubscr...@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/11e60ab4-be7f-4d83-a308-001c0916f13a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multiple Form Submit with Single Submit Button

2013-07-29 Thread pattinson
I'm currently working with django project. I had to filter the data store 
on the database based on the user input on form (at template) as looked 
below.




On form user either enter value or leave it blank. So what I have to do is 
first find the (valid) user input and then fire appropriate query to 
display data as user input in the form. So final result should be displayed 
on table at template.

As I'm new to django, how should I have to pass the data and fire query to 
represent data at multiple field. As help or link related to these type 
problem are expected. ( I just able to filter from the database with only 
one form and had no concept to solve this.)

Model of my temp project is as below.

class exReporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField()
gender = models.CharField(max_length=1)
age = models.IntegerField()
label = models.IntegerField()


-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/groups/opt_out.