def property_group_delete(group_id): group = PropertyGroup.get(group_id) if group is None: flash(f"Eigenschaftengruppe mit ID {group_id} existiert nicht!", 'error') abort(404) form = FlaskForm() if form.is_submitted(): delete_property_group(group, current_user) session.session.commit() flash('Eigenschaftsgruppe gelöscht.', 'success') return redirect(url_for('.property_groups')) form_args = { 'form': form, 'cancel_to': url_for('.property_groups'), 'submit_text': 'Löschen', 'actions_offset': 0 } return render_template( 'generic_form.html', page_title=f"Eigenschaftsgruppe '{group.name}' löschen", form_args=form_args, form=form)
def property_group_edit(group_id): group = PropertyGroup.get(group_id) if group is None: flash(f"Eigenschaftengruppe mit ID {group_id} existiert nicht!", 'error') abort(404) form = PropertyGroupForm(obj=group) if form.is_submitted(): edit_property_group(group, form.name.data, form.permission_level.data, current_user) session.session.commit() flash('Eigenschaftsgruppe bearbeitet.', 'success') return redirect(url_for('.property_groups')) form_args = { 'form': form, 'cancel_to': url_for('.property_groups'), 'submit_text': 'Speichern' } return render_template( 'generic_form.html', page_title=f"Eigenschaftsgruppe '{group.name}' bearbeiten", form_args=form_args, form=form)
def property_group_deny_property(group_id, property_name): property_group = PropertyGroup.get(group_id) if property_group is None: flash(f"Eigenschaftengruppe mit ID {group_id} existiert nicht!", 'error') abort(404) deny_property(property_group, property_name) session.session.commit() message = 'Eigenschaft {0} der Gruppe {1} verboten.' flash(message.format(property_name, property_group.name), 'success') return redirect(url_for('.property_groups'))