From 244503d305bacb67b9e5e27bd689abca244f000f Mon Sep 17 00:00:00 2001 From: Rushil Umaretiya Date: Mon, 20 Sep 2021 06:25:34 -0400 Subject: [PATCH] feat: added descriptions to categories --- .../migrations/0009_auto_20210920_1019.py | 23 +++++++++++++++++++ .../0010_remove_category_category.py | 17 ++++++++++++++ hunt/apps/main/models.py | 2 +- hunt/templates/main/index.html | 3 +++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 hunt/apps/main/migrations/0009_auto_20210920_1019.py create mode 100644 hunt/apps/main/migrations/0010_remove_category_category.py diff --git a/hunt/apps/main/migrations/0009_auto_20210920_1019.py b/hunt/apps/main/migrations/0009_auto_20210920_1019.py new file mode 100644 index 0000000..113de4f --- /dev/null +++ b/hunt/apps/main/migrations/0009_auto_20210920_1019.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.7 on 2021-09-20 10:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0008_rename_available_challenge_unblocked'), + ] + + operations = [ + migrations.RemoveField( + model_name='category', + name='slug', + ), + migrations.AddField( + model_name='category', + name='description', + field=models.CharField(default='', max_length=200), + preserve_default=False, + ), + ] diff --git a/hunt/apps/main/migrations/0010_remove_category_category.py b/hunt/apps/main/migrations/0010_remove_category_category.py new file mode 100644 index 0000000..558b6ae --- /dev/null +++ b/hunt/apps/main/migrations/0010_remove_category_category.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.7 on 2021-09-20 10:20 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0009_auto_20210920_1019'), + ] + + operations = [ + migrations.RemoveField( + model_name='category', + name='category', + ), + ] diff --git a/hunt/apps/main/models.py b/hunt/apps/main/models.py index b485800..0fd51ec 100644 --- a/hunt/apps/main/models.py +++ b/hunt/apps/main/models.py @@ -5,7 +5,7 @@ from ckeditor.fields import RichTextField class Category(models.Model): id = models.AutoField(primary_key=True, null=False, blank=False) name = models.CharField(max_length=200, null=False, blank=False) - category = models.CharField(max_length=200, null=False, blank=False) + description = models.CharField(max_length=200, null=False, blank=False) def __str__(self): return self.name diff --git a/hunt/templates/main/index.html b/hunt/templates/main/index.html index 64f3f29..5d9cfba 100644 --- a/hunt/templates/main/index.html +++ b/hunt/templates/main/index.html @@ -38,6 +38,9 @@

{{ category.name }}

toggle

+
+

{{category.description}}

+
{% for challenge, status in challenges.items %} {% if status.0.unblocked %}