예제 #1
0
def getEvent(request, identifier):
	event = Event.objects.get(pk=identifier)
	date_fix = event.date.strftime('%m/%d/%Y')
	time_fix = event.time.strftime('%H:%M:%S')
	event_dict = {'identifier': event.pk, 'title': event.title, 'description': event.description, 'time': time_fix, 'date': date_fix, 'address': event.address, 'org': event.org, 'going_count': event.going_count, 'hashtag': event.hashtag}
	json_returned = simplejson.dumps(event_dict)
	return cHttpResponse(json_returned)
예제 #2
0
def processImGoing(request, identifier):
	event = Event.objects.get(pk=identifier)
	event.going_count += 1
	event.save()

	json = {'status': 'done'}
	json_returned = simplejson.dumps(json)

	return cHttpResponse(json_returned)
예제 #3
0
def getEvents(request, year, month, day):
	date_string = year+month+day
	date_search_query = datetime.datetime.strptime(date_string, '%Y%m%d').date()
	event_for_day = Event.objects.filter(date=date_search_query).order_by('-going_count')
	event_list = []
	for event in event_for_day:
		date_fix = event.date.strftime('%m/%d/%Y')
		time_fix = event.time.strftime('%H:%M:%S')
		event_dict = {'identifier': event.pk, 'title': event.title, 'description': event.description, 'time': time_fix, 'date': date_fix, 'address': event.address}
		event_list.append(event_dict)
	json_returned = simplejson.dumps(event_list)
	return cHttpResponse(json_returned)
예제 #4
0
def getEventsWithDateRange(request, year, month, day, year1, month1, day1):
	date_string = year+'-'+month+'-'+day
	date_string1 = year1+'-'+month1+'-'+day1

	event_for_day = Event.objects.filter(date__range=[date_string, date_string1]).order_by('-going_count')
	event_list = []
	for event in event_for_day:
		date_fix = event.date.strftime('%m/%d/%Y')
		time_fix = event.time.strftime('%H:%M:%S')
		event_dict = {'identifier': event.pk, 'title': event.title, 'description': event.description, 'time': time_fix, 'date': date_fix, 'address': event.address}
		event_list.append(event_dict)
	json_returned = simplejson.dumps(event_list)
	return cHttpResponse(json_returned)