def update_representing_for(category): persons = [(pm.meeting, pm.person) for pm in PersonMeeting.select().where( category=category.data['id'])] for meeting, person in persons: person.data['printout_representing'] = person.rep(meeting, category=category) or '' person.save()
def get_person_category_or_404(meeting_id, person_id=None, category_id=None): if not category_id: try: category_id = PersonMeeting.select().where(meeting=meeting_id, person=person_id).get().category except PersonMeeting.DoesNotExist: flask.abort(404) try: category = Category.select().where( data__contains={'id': str(category_id)} ).join(CategoryMeeting).where(meeting_id=str(meeting_id)).get() except Category.DoesNotExist: flask.abort(404) return category