Last active
August 29, 2015 14:06
-
-
Save j00bar/30f89e352ff0c134fcb2 to your computer and use it in GitHub Desktop.
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 photoset_as_json(photoset_id): | |
# ... | |
photoset_obj = PhotoSet.objects.get(pk=photoset_id).select_related('owner').prefetch_related('photo') | |
dict_[photos] = [photo_as_json(p) for p in photoset_obj.photo_set.all()] | |
dict_[owner] = user_as_json(photoset_obj.owner) | |
# ... | |
return dict_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment