I think for the link view function, I need to do something like this
instead. Sorry.
[--code--]
def link(request):
c = Context()
c['title'] = ['Home Page', 'Current Time', '10 hours later']
return render_to_response('time.html', c)
[--code--]
On Oct 17, 1:06 pm, John Yeukhon Wong <[email protected]> wrote:
> 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):
> title = ['Home Page', 'Current Time', '10 hours later']
> return render_to_response('time.html', title)
> [--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--]
>
> 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!!!
--
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en.