コード例 #1
0
ファイル: views.py プロジェクト: swatisaoji1/eventbrite-demo
def events(request, categories_string='', page_no=1):
	"""
	retrives the events based on categories string and passes them to event page.
	"""
	if request.method == "POST":
		categories_string = ','.join(request.POST.getlist('categories'))
	if categories_string =='':
		categories = services.get_categories()
		return render(request, "events/home.html", categories)
	else:
		events = services.get_events(categories_string, page_no)
		return render(request, "events/events.html", {'data': events})
コード例 #2
0
ファイル: views.py プロジェクト: swatisaoji1/eventbrite-demo
def home_page(request):
	"""
	retrives the categories and passes them to home page.
	"""
	categories = services.get_categories()
	return render(request, "events/home.html", categories)
コード例 #3
0
ファイル: tests.py プロジェクト: swatisaoji1/eventbrite-demo
	def test_services_get_categories(self):
		categories = get_categories()
		self.assertIsNotNone(categories)