Skip to content

Instantly share code, notes, and snippets.

@comtom
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save comtom/9390249 to your computer and use it in GitHub Desktop.

Select an option

Save comtom/9390249 to your computer and use it in GitHub Desktop.
Example Django AJAX view
def getSomething(request):
""" get something model in a format that fullcalendar can read """
userId = request.user
somethingList = Something.objects.filter(something__user__id=userId)
results = []
for something in somethingList:
something_dict = {'id':something.id, 'title':something.title, 'start':str(something.startdate), 'end':str(something.enddate), 'allDay':True, 'editable':True }
results.append(something_dict)
return simplejson.dumps(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment