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
def hydrate_device(self, bundle): | |
""" | |
override hydrate method for incoming bundle hydrate is done on a per field basis (really cool) | |
so this allows to override only the one (related field) and to strip the JSON data from the PUT | |
request thus allowing PUT request to go through successfully. NOTE: Only for PUT requests - we need | |
this data for POST or else the related field (device) wont be created | |
Issue stems from the relation - DeviceSettings has one-to-one to Device, DeviceSettings stores meta | |
data and other stuff about the device w/o interferring with the original device model and allowing | |
separation of concerns to make the Device and Service models work as standalone app for apns/gcm. Thus, | |
unique foreign key constraint on the Device model w/ APNService FK & due to one way relationship |