Skip to content

Instantly share code, notes, and snippets.

@aviars
Created February 10, 2012 16:16
Show Gist options
  • Save aviars/1790557 to your computer and use it in GitHub Desktop.
Save aviars/1790557 to your computer and use it in GitHub Desktop.
def save(self, **kwargs):
#Create/Update a RESTCAT tx
extra_fields = jsonify_extra_fields(self)
if not self.idtransaction:
from ..tracker.models import idTransaction
self.idtransaction=idTransaction.objects.create(subject=self.patient,
sender=self.worker,
receiver=self.worker,
extra_fields=jsonify_extra_fields(self))
super(Linkage, self).save(**kwargs)
else:
#Check to see if the record has been updated.
extra_fields = jsonify_extra_fields(self)
if str(self.idtransaction.extra_fields) != str(extra_fields):
self.idtransaction.extra_fields = extra_fields
self.idtransaction.save()
super(GPRAIntakeInterview, self).save(**kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment