Created
December 24, 2010 15:10
-
-
Save bohde/754323 to your computer and use it in GitHub Desktop.
Running logic on update in tastypie
This file contains 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
from tastypie.resources import ModelResource | |
class FlaggedResource(ModelResource): | |
def obj_update(self, bundle, request=None, **kwargs): | |
processFlag = bundle.obj and not bundle.obj.flagged | |
bundle = super(FlaggedResource, self).obj_update(bundle, request, **kwargs) | |
if processFlag: | |
bundle.obj.flagLogic() | |
return bundle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment