def setId(self, Id): anime = AnimeXModel.getOneXModel([Id]) if anime is None: raise Http404() self.initial = { 'title' : anime.Title, 'authored_by' : anime.Authored_by, 'desc' : anime.Description, 'address' : anime.Web_address } self.entity_title = anime.Title super(AnimeEntity, self).setId(Id) self.setChoices()
def setId(self, Id): anime = AnimeXModel.getOneXModel([Id]) if anime is None: raise Http404() cursor = connection.cursor() cursor.execute('SELECT `Address` FROM `ANIME_IMAGE` WHERE `Anime_id` = %s;', [Id]) rows = cursor.fetchall() urls = [ x[0] for x in rows ] if urls: t = '\n'.join(urls) self.initial = { 'address' : t } self.entity_title = 'Edit images of %s' % anime.Title super(AnimeImageEntity, self).setId(Id)