def username(self, username): username = username.strip() try: other = self.get_key_by_username(username) if as_key(other) != as_key(self.key): raise ModelError("There is already a Dj with this username", other) except NoSuchUsername: pass self.purge_own_username_cache() self.raw.username = username
def has_dj(self, dj): return dj is not None and as_key(dj) in self.dj_list
def set_all_cache(cls, key_set): return cls.cache_set(set([as_key(key) for key in key_set]), cls.ALL)