Skip to content

Commit 36ad3fe

Browse files
committed
merge finished
2 parents 9dbe60f + dd2f592 commit 36ad3fe

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed

flowapp/templates/forms/api_key.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h6>ApiKey: {{ generated_key }}</h6>
1313
<form action="{{ action_url }}" method="POST">
1414
{{ form.hidden_tag() if form.hidden_tag }}
1515
<div class="row">
16-
<div class="col-sm-5">
16+
<div class="col-smfut-5">
1717
{{ render_field(form.machine) }}
1818
</div>
1919
<div class="col-sm-2">

flowapp/views/admin.py

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def add_machine_key():
7676
expires=form.expires.data,
7777
readonly=form.readonly.data,
7878
comment=form.comment.data,
79-
user_id=session["user_id"]
79+
user_id=session["user_id"],
8080
)
8181

8282
db.session.add(model)
@@ -87,10 +87,7 @@ def add_machine_key():
8787
else:
8888
for field, errors in form.errors.items():
8989
for error in errors:
90-
print(
91-
"Error in the %s field - %s"
92-
% (getattr(form, field).label.text, error)
93-
)
90+
print("Error in the %s field - %s" % (getattr(form, field).label.text, error))
9491

9592
return render_template("forms/machine_api_key.html", form=form, generated_key=generated)
9693

@@ -117,12 +114,8 @@ def delete_machine_key(key_id):
117114
@admin_required
118115
def user():
119116
form = UserForm(request.form)
120-
form.role_ids.choices = [
121-
(g.id, g.name) for g in db.session.query(Role).order_by("name")
122-
]
123-
form.org_ids.choices = [
124-
(g.id, g.name) for g in db.session.query(Organization).order_by("name")
125-
]
117+
form.role_ids.choices = [(g.id, g.name) for g in db.session.query(Role).order_by("name")]
118+
form.org_ids.choices = [(g.id, g.name) for g in db.session.query(Organization).order_by("name")]
126119

127120
if request.method == "POST" and form.validate():
128121
# test if user is unique
@@ -157,12 +150,8 @@ def user():
157150
def edit_user(user_id):
158151
user = db.session.query(User).get(user_id)
159152
form = UserForm(request.form, obj=user)
160-
form.role_ids.choices = [
161-
(g.id, g.name) for g in db.session.query(Role).order_by("name")
162-
]
163-
form.org_ids.choices = [
164-
(g.id, g.name) for g in db.session.query(Organization).order_by("name")
165-
]
153+
form.role_ids.choices = [(g.id, g.name) for g in db.session.query(Role).order_by("name")]
154+
form.org_ids.choices = [(g.id, g.name) for g in db.session.query(Organization).order_by("name")]
166155

167156
if request.method == "POST" and form.validate():
168157
user.update(form)
@@ -233,9 +222,7 @@ def organization():
233222
flash("Organization saved")
234223
return redirect(url_for("admin.organizations"))
235224
else:
236-
flash(
237-
"Organization {} already exists".format(form.name.data), "alert-danger"
238-
)
225+
flash("Organization {} already exists".format(form.name.data), "alert-danger")
239226

240227
action_url = url_for("admin.organization")
241228
return render_template(
@@ -391,9 +378,7 @@ def action():
391378
return redirect(url_for("admin.actions"))
392379
else:
393380
flash(
394-
"Action with name {} or command {} already exists".format(
395-
form.name.data, form.command.data
396-
),
381+
"Action with name {} or command {} already exists".format(form.name.data, form.command.data),
397382
"alert-danger",
398383
)
399384

@@ -480,9 +465,7 @@ def community():
480465
flash("Community saved", "alert-success")
481466
return redirect(url_for("admin.communities"))
482467
else:
483-
flash(
484-
f"Community with name {form.name.data} already exists", "alert-danger"
485-
)
468+
flash(f"Community with name {form.name.data} already exists", "alert-danger")
486469

487470
community_url = url_for("admin.community")
488471
return render_template(
@@ -527,9 +510,7 @@ def delete_community(community_id):
527510
try:
528511
db.session.commit()
529512
except IntegrityError:
530-
message = "Community {} is in use in some rules, can not be deleted!".format(
531-
aname
532-
)
513+
message = "Community {} is in use in some rules, can not be deleted!".format(aname)
533514
alert_type = "alert-danger"
534515

535516
flash(message, alert_type)

0 commit comments

Comments
 (0)