Last active
August 29, 2015 13:57
-
-
Save comtom/9390249 to your computer and use it in GitHub Desktop.
Example Django AJAX view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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