Closed Jaymon closed 4 years ago
satisfies the jsonable() todo in the above class
def jsonable(self):
d = super(Orm, self).jsonable()
class_name = self.__class__.__name__.lower()
d["{}_id".format(class_name)] = self.pk
return d
we have used some variation of this base class in a few projects:
It would be great to implement the todo also, so it would take
_id
and convert it tofoo_id
, I'm not sure if it this should be the default Model class but it would be nice to have the option to just easily pull this into other projects.The above class was pulled from Reach, and there might be tests for it somewhere in those tests