Sorry for the mis-post.. I however found my probelm...
self.render_to_response('sitesearch.html', {
'query': int(myid), <--- converted to int...
'pics': pics,
On Apr 12, 11:36 pm, murray <[email protected]> wrote:
> My ultimate goal is to create a nested list with sub-list items that
> are controlled by a div tag and
> will expand when the the "parent" link is clicked.
>
> - Link1
> - Link2
> - SubLink1
> - SubLink2
> - SubLink3
> - Link3
> - Link4
>
> i.e. if you clicked on "Link3", then "Link2's" sublinks will be hidden
> and "Link3's" will expand.
>
> To accomplish this I created two DB's CategoryDB and SubCategoryDB
> with a reference category field
> The following defines my db's
> ----------------------------------------------- CODE
> ----------------------
> class CategoryDb(db.Model):
> name = db.StringProperty(multiline=True)
> descritpion = db.StringProperty(multiline=True)
> id = db.IntegerProperty(default = 0)
> tags = db.StringListProperty()
>
> class SubCategoryDb(db.Model):
> name = db.StringProperty(multiline=True)
> id = db.IntegerProperty(default = 0)
> tags = db.StringListProperty()
> parentid = db.IntegerProperty(default = 0)
> category = db.ReferenceProperty(CategoryDb,
> collection_name='subcategories')
> -------------------------------------------- CODE
> --------------------------
>
> This is where my issue begins...
> The below mentioned code pushes the results from a db query to the
> Window.
>
> ----------------------------------- CODE
> --------------------------------
> class SiteSearch(ImageSharingBaseHandler):
> def get(self):
> """Displays the tag search box and possibly a list of results."""
> myid= cgi.escape(self.request.get('id'))
> query = cgi.escape(self.request.get('q'))
> pics = []
> subcategory_query = []
> if query:
> pics = Picture.all().filter('tags =', query)
> else:
> query = ''
>
> categories_query = CategoryDb.all().order('id')
> category = categories_query.fetch(99)
>
> bestseller_query = BestsellersDb.all().order('id')
> bestseller = bestseller_query.fetch(99)
>
> showedit = False
> login=False
> if users.get_current_user():
> if (users.get_current_user().email()=='[email protected]'):
> showedit = True
> else:
> showedit = False
> login=True
> else:
> showedit = False
>
> if users.get_current_user():
> user = users.GetCurrentUser()
> #self.response.out.write('Welcome, ' + user.nickname())
> url = users.create_logout_url(self.request.uri)
> url_linktext = 'Welcome, ' + user.nickname()
> else:
> url = users.create_login_url(self.request.uri)
> url_linktext ='Click here to Login'
>
> self.render_to_response('sitesearch.html', {
> 'query': myid,
> 'pics': pics,
> 'islogin':login,
> 'bestsellers':bestseller,
> 'categories':category,
> 'showedit':showedit,
> 'url': url,
> 'url_linktext': url_linktext
> })
> -------------------- CODE ------------------
>
> The problem is that ...the following code fail on the
> ifequal ...
>
> <UL>
> {% for category in categories %}
> <LI class="bg_list">
> <A href="sitesearch?id={{category.id}}&q={% for
> tag in category.tags %}{{tag}}{% if not forloop.last %},{% endif %}{%
> endfor %}">{{ category.name }}</A>
>
> {% for sub_category in category.subcategories %}
> {% ifequal query sub_category.parentid %}
> <-------- This fails everytime....
> <LI class="bg_list_sub"> <A
> href="sitesearch?q={% for tag in sub_category.tags %} {{tag}}{% if not
> forloop.last %},{% endif %}
>
> {% endfor %}">{{ sub_category.name }}</A>
>
> { % endifequal %}
> {% endfor %}
> {% endfor %}
> </UL>
>
> when nested, this line... {% ifequal query sub_category.parentid %}
> will tell
> which sub list to expand.... based on the the "query" var which is
> merely the
> id that should match the sub list's parentid...
>
> H E L P
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---