I asked this somewhere else but it seems like the responder hasn't
reply the latest comment I made.
http://stackoverflow.com/questions/3951758/how-do-you-iterate-over-a-...
Nevertheless, I think I should be welcome to make one here.
Let's keep thing short.
Say I have a very simple list to iterate
[--code--]
def link(request):
c = Context()
c['title'] = ['Home Page', 'Current Time', '10 hours later']
return render_to_response('time.html', c)
[--code--]
Now say I also have another view called current_time
In my html I had, for example
[--code--]
{% for item in title %}
{{item}}
{% if not forloop.last %} | {% endif %}
{% endfor %}
{% if hour <= 1 %}
do something...
{% endif %}
[--code--]
For the template, I tried loop through "in c.title, in c, in title"
and still doesn't work
As you can guess, I use two view functions in a single html file.
The problem is that I received 'function' object is not iterable
So the guy said I probably had a problem with the URL
my URL --> (r'^now/$', current_time, link),
So he recommended me doing this
(r'^articles/(?P<current_time>\(?P<link>)/$',
'project_name.views.link'), #the second tuple element is the view
function
Something similar to Django URL Dispatcher (from the dispatcher
chapter).. I think...
I think he meant to capture then. But what I want to do is really
just, say, localhost/now/ and load the page
I can definitely integrate two views functions into one single
function, which works fine.
The question is, how can I assign multiple views function in a single
URL???
Thank you for any input in advance!!!