Created
July 9, 2015 16:29
-
-
Save jobelenus/0dcaeb3a4ab43b78cc87 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 get_product(self, instance): | |
if isinstance(instance, django_models.Model): | |
return instance.product | |
else: | |
try: | |
return api.TransientProduct(instance.product) | |
except: | |
return api.TransientProduct(instance['product']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment