python - Django multiple model inheritance, django-push-notifications -


i writing end mobile app using django 1.8. django-push-notifications lib provides gcmdevice model. problem have device model mandatory field , logic don't want lose.

what wanted inherit whole gcmdevice functionality , adjust them device model(which btw inherits mixin providing spatial data fields, custom object manager set want keep). read 3 different django model inheritance ideas none of them seem solve problem (keeping managers, provide django-push-notifications functionality, keeping device model fields). maybe onetoone association work?

idea:

class device(mymixin):     gcm_device = models.onetoonefield(gcmdevice)     my_other_field = models.textfield()      def send_message(self, payload):         self.gcm_device.send_message(payload) 

any reason why necessary inherit? composition substitute trying inheritance?

----------------- edited answer -----------------

class device(models.model):     ...     gcm_device = models.onetoonefield(gcmdevice) 

i have given simple case, make gcm device primary key well.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -