Clean code a bit

in-house-export-serialization
Kevin Chung 2020-04-25 02:55:22 -04:00
parent 58246bad18
commit dbb07b5beb
1 changed files with 4 additions and 7 deletions

View File

@ -15,8 +15,8 @@ from CTFd.utils.decorators import admins_only
@admins_only
def challenges_listing():
q = request.args.get("q")
field = request.args.get("field")
if q:
field = request.args.get("field")
challenges = []
if Challenges.__mapper__.has_property(
field
@ -28,14 +28,11 @@ def challenges_listing():
.order_by(Challenges.id.asc())
.all()
)
return render_template(
"admin/challenges/challenges.html", challenges=challenges, q=q, field=field
)
else:
challenges = Challenges.query.all()
return render_template(
"admin/challenges/challenges.html", challenges=challenges
)
return render_template(
"admin/challenges/challenges.html", challenges=challenges, q=q, field=field
)
@admin.route("/admin/challenges/<int:challenge_id>")