Skip to content

Commit

Permalink
icon -> award.belt
Browse files Browse the repository at this point in the history
  • Loading branch information
robwaz committed Jan 8, 2024
1 parent 5835d2d commit 709f1fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion dojo_plugin/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class Dojos(db.Model):
id = db.Column(db.String(32), index=True)
name = db.Column(db.String(128))
description = db.Column(db.Text)
icon = db.Column(db.String(256))

official = db.Column(db.Boolean, index=True)
password = db.Column(db.String(128))
Expand Down
5 changes: 2 additions & 3 deletions dojo_plugin/utils/dojo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@
**ID_NAME_DESCRIPTION,
**VISIBILITY,

Optional("icon"): IMAGE_REGEX,

Optional("password"): Regex(r"^[\S ]{8,128}$"),

Optional("type"): ID_REGEX,
Optional("award"): {
Optional("emoji"): Regex(r"^\S$"),
Optional("belt"): IMAGE_REGEX
},

Optional("image"): IMAGE_REGEX,
Expand Down Expand Up @@ -195,7 +194,7 @@ def assert_one(query, error_message):

dojo_kwargs = {
field: dojo_data.get(field, getattr(import_dojo, field, None))
for field in ["id", "name", "description", "password", "type", "award", "icon"]
for field in ["id", "name", "description", "password", "type", "award"]
}

if dojo is None:
Expand Down
2 changes: 1 addition & 1 deletion dojo_theme/templates/dojos.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2>{{ type | title }}</h2>
{{ card(url_for("pwncollege_dojos.view_dojo", dojo=dojo.reference_id),
title=dojo.name,
text="{} Modules : ".format(dojo.modules | length) + "{} / {}".format(dojo.solves(user=user, ignore_visibility=True, ignore_admins=False).count() if user else 0, dojo.challenges | length),
icon="/themes/dojo_theme/static/img/dojo/{}".format(dojo.icon) if (dojo.icon and dojo.official) else None) }}
icon="/themes/dojo_theme/static/img/dojo/{}.svg".format(dojo.award.belt) if (dojo.award.belt and dojo.official) else None) }}
{% endfor %}

{% if type == "More" %}
Expand Down

0 comments on commit 709f1fc

Please sign in to comment.