def create_from_uid(self, uid): ''' Returns new order referenced to given uid: user id or session key Returns None if uid is not valid. ''' kwargs = resolve_uid(uid) if len(kwargs): return self.get_query_set().create(**kwargs) else: return None
def from_uid(self, uid): ''' Utility method, returns QuerySet of order objects referenced to given uid: User id or session key Returns empty queryset if nothing found ''' kwargs = resolve_uid(uid) if len(kwargs): return self.get_query_set().filter(**kwargs) else: return self.get_empty_query_set()