def test_get_nearby_events(self): target_event = self.create_event(status="APPROVED") nearby_event = self.create_event(status="APPROVED") nearby = get_nearby_events(target_event) self.assertEqual(1, len(nearby)) self.assertEqual(nearby_event.pk, nearby[0].pk) self.create_event(status="APPROVED", country_code="HR") nearby = get_nearby_events(target_event) self.assertEqual(1, len(nearby)) self.create_event(status="PENDING") nearby = get_nearby_events(target_event) self.assertEqual(1, len(nearby))
def view_event(request, event_id, slug): event = get_event_by_id(event_id) next_event = get_next_or_previous(event, country_code=event.country) nearby = get_nearby_events(event, limit=10) return render_to_response( 'pages/view_event.html', { 'event': event, 'next_event': next_event, 'nearby': nearby }, context_instance=RequestContext(request))
def view_event(request, event_id, slug): event = get_event_by_id(event_id) next_event = get_next_or_previous(event, country_code=event.country) nearby = get_nearby_events(event, limit=10) return render_to_response('pages/view_event.html', { 'event': event, 'next_event': next_event, 'nearby': nearby }, context_instance=RequestContext(request))
def view_event(request, event_id, slug): try: event = get_event_by_id(event_id) except ObjectDoesNotExist as e: raise Http404 next_event = get_next_or_previous(event, country_code=event.country) nearby = get_nearby_events(event, limit=4) return render_to_response( "pages/view_event.html", {"event": event, "next_event": next_event, "nearby": nearby}, context_instance=RequestContext(request), )
def view_event(request, event_id, slug): try: event = get_event_by_id(event_id) except ObjectDoesNotExist as e: raise Http404 next_event = get_next_or_previous(event, country_code=event.country) nearby = get_nearby_events(event, limit=4) return render_to_response('pages/view_event.html', { 'event': event, 'next_event': next_event, 'nearby': nearby }, context_instance=RequestContext(request))