コード例 #1
0
ファイル: models.py プロジェクト: eaudeweb/cites-meetings
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()
コード例 #2
0
ファイル: models.py プロジェクト: eaudeweb/cites-meetings
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