Esempio n. 1
0
def delete_actor(actor_id):
    try:
        if current_user.is_admin:
            actor = session.query(Actor).get(actor_id)
        else:
            actor = session.query(Actor).filter(
                and_(Actor.id == actor_id,
                     Actor.owner_id == current_user.id)).one()
    except NoResultFound:
        return redirect('/actors/all')
    session.delete(actor)
    return redirect('/actors/all?success=1')
Esempio n. 2
0
def delete_event(event_id):
    try:
        if current_user.is_admin:
            event = session.query(Event).get(event_id)
        else:
            event = session.query(Event).filter(
                and_(Event.id == event_id,
                     Event.owner_id == current_user.id)).one()
    except NoResultFound:
        return redirect('/events/all')
    session.delete(event)
    session.flush()
    return redirect('/events/all?success=1')
Esempio n. 3
0
def delete_international_authority(international_authority_id):
    intl_auth = session.query(InternationalAuthority).get(
        international_authority_id)
    session.delete(intl_auth)
    session.flush()
    return redirect('/international_authorities/all?success=1')
Esempio n. 4
0
def delete_profession(profession_id):
    profession = session.query(Profession).get(profession_id)
    session.delete(profession)
    session.flush()
    return redirect('/professions/all?success=1')
Esempio n. 5
0
def delete_event_type(event_type_id):
    event_type = session.query(EventType).get(event_type_id)
    session.delete(event_type)
    session.flush()
    return redirect('/event_types/all?success=1')
Esempio n. 6
0
def delete_release_type(release_type_id):
    release_type = session.query(ReleaseType).get(release_type_id)
    session.delete(release_type)
    session.flush()
    return redirect('/release_types/all?success=1')
Esempio n. 7
0
def delete_organisation(organisation_id):
    organisation = session.query(Organisation).get(organisation_id)
    session.delete(organisation)
    session.flush()
    return redirect('/organisations/all?success=1')
Esempio n. 8
0
def delete_user(user_id):
    user = session.query(User).get(user_id)
    session.delete(user)
    session.flush()
    return redirect('/users/all?success=1')
Esempio n. 9
0
def delete_source(source_id):
    source = session.query(Source).get(source_id)
    session.delete(source)
    session.flush()
    return redirect('/sources/all?success=1')
Esempio n. 10
0
def delete_prison_type(prison_type_id):
    prison_type = session.query(PrisonType).get(prison_type_id)
    session.delete(prison_type)
    session.flush()
    return redirect('/prison_types/all?success=1')
Esempio n. 11
0
def delete_location(location_id):
    location = session.query(Location).get(location_id)
    session.delete(location)
    session.flush()
    return redirect('/locations/all?success=1')