Beispiel #1
0
 def get_pk_value(self, model):
     """
         Return the primary key value from a model object.
         If there are multiple primary keys, they're encoded into string representation.
     """
     if isinstance(self._primary_key, tuple):
         return tools.iterencode(getattr(model, attr) for attr in self._primary_key)
     else:
         return getattr(model, self._primary_key)
Beispiel #2
0
 def get_pk_value(self, model):
     """
         Return the primary key value from a model object.
         If there are multiple primary keys, they're encoded into string representation.
     """
     if isinstance(self._primary_key, tuple):
         return tools.iterencode(getattr(model, attr) for attr in self._primary_key)
     else:
         return getattr(model, self._primary_key)