DuncanM wrote:
> My events.views:
> [code]
> from sakushi.events.models import Event
> from sakushi.news.models import News
> from django.shortcuts import get_object_or_404, render_to_response
> from django.http import HttpResponseRedirect
>
> def events(request):
>   latest_events_list = Event.objects.all().order_by('date')[:5]
>   return render_to_response('events.html', {'latest_events_list':
> latest_events_list})
>
> def news(request):
>   latest_news_list = News.objects.all().order_by('date')[:5]
>   return render_to_response('events.html', {'latest_news_list':
> latest_news_list})
>   
It seems like for your situation, you'll have to introduce a third view
"home", which would look like:

def home(request):
    latest_events_list = Event.objects.all().order_by('date')[:5]
    latest_news_list = News.objects.all().order_by('date')[:5]
    return render_to_response('home.html', {'latest_news_list':
latest_news_list,
                                                                       
     'latest_events_list': latest_events_list})

Then home.html would be exactly like your current template for
events.html. The idea is to combine both lists into a single view. Add
another line to your URLS, like

(r'^home/', 'sakushi.events.views.home'),

And you'll be set.

Nick


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to