Beispiel #1
0
def home(request):
    ads = Ad.get_active_ads()
    listings = Listing.objects.filter(
        status="published").order_by("-created_at")[:15]
    upcoming_events = Event.get_upcoming_events()
    latest_forum_activity = ForumThread.get_latest()
    context = {
        "ads": ads,
        "listings": listings,
        "upcoming_events": upcoming_events,
        "latest_forum_activity": latest_forum_activity
    }
    return render(request, "pages/home.html", context)
Beispiel #2
0
def get_upcoming_events():
    """
    `get_upcoming_events` returns a queryset of all events that will soon take place.
    """
    return Event.get_upcoming_events()