mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 22:44:24 +01:00
Clean code a bit
This commit is contained in:
@@ -15,8 +15,8 @@ from CTFd.utils.decorators import admins_only
|
|||||||
@admins_only
|
@admins_only
|
||||||
def challenges_listing():
|
def challenges_listing():
|
||||||
q = request.args.get("q")
|
q = request.args.get("q")
|
||||||
if q:
|
|
||||||
field = request.args.get("field")
|
field = request.args.get("field")
|
||||||
|
if q:
|
||||||
challenges = []
|
challenges = []
|
||||||
if Challenges.__mapper__.has_property(
|
if Challenges.__mapper__.has_property(
|
||||||
field
|
field
|
||||||
@@ -28,13 +28,10 @@ def challenges_listing():
|
|||||||
.order_by(Challenges.id.asc())
|
.order_by(Challenges.id.asc())
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
return render_template(
|
|
||||||
"admin/challenges/challenges.html", challenges=challenges, q=q, field=field
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
challenges = Challenges.query.all()
|
challenges = Challenges.query.all()
|
||||||
return render_template(
|
return render_template(
|
||||||
"admin/challenges/challenges.html", challenges=challenges
|
"admin/challenges/challenges.html", challenges=challenges, q=q, field=field
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user