Skip to content

Commit

Permalink
Show Diamond Creator (#284)
Browse files Browse the repository at this point in the history
* Show Diamond Creator

* lint

* Change presentation

---------

Co-authored-by: Evan Chen <evan@evanchen.cc>
  • Loading branch information
Incompleteusern and vEnhance committed Aug 25, 2023
1 parent bf87a3a commit e65e748
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rpg/migrations/0007_achievement_show_creator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.2.4 on 2023-08-25 18:21

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("rpg", "0006_alter_achievement_always_show_image_and_more"),
]

operations = [
migrations.AddField(
model_name="achievement",
name="show_creator",
field=models.BooleanField(
default=False,
help_text="If enabled, the creator of a diamond is shown on the diamond page.",
verbose_name="Show Creator",
),
),
]
5 changes: 5 additions & 0 deletions rpg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ class Achievement(models.Model):
help_text="If enabled, the solution page for a diamond is available to those who have unlocked the diamond.",
verbose_name="Show Solution",
)
show_creator = models.BooleanField(
default=False,
help_text="If enabled, the creator of a diamond is shown on the diamond page.",
verbose_name="Show Creator",
)

class Meta:
db_table = "dashboard_achievement"
Expand Down
5 changes: 5 additions & 0 deletions rpg/templates/rpg/diamond_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
{% endif %}
{% if request.user.is_staff or achievement.obtained %}
<p class="fst-italic">{{ achievement.description }}</p>
{% if achievement.creator and achievement.show_creator %}
<p class='text-secondary'>
Forged by <i>{{ achievement.creator.get_display_name }}</i>.
</p>
{% endif %}
{% else %}
<p class="text-muted">You have not found this achievement yet.</p>
{% endif %}
Expand Down

0 comments on commit e65e748

Please sign in to comment.