def display_collection(self, id): collection = Collection.get_by_id(self.db, id); if collection == None: raise Exception("No collection with id {}!".format(id)) Collection.print_table_header() collection.print_for_table() items = Item.get_by_collection(self.db, collection.id) print("ITEMS") Item.print_table_header() for item in items: item.print_for_table()
def list_collections(self): collections = Collection.get_all(self.db) print("COLLECTIONS") Collection.print_table_header() for collection in collections: collection.print_for_table()