diff --git a/neighbourhood/migrations/0025_team_description_team_has_rich_description.py b/neighbourhood/migrations/0025_team_description_team_has_rich_description.py new file mode 100644 index 0000000..dd81493 --- /dev/null +++ b/neighbourhood/migrations/0025_team_description_team_has_rich_description.py @@ -0,0 +1,27 @@ +# Generated by Django 4.1 on 2024-10-04 13:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("neighbourhood", "0024_team_boundary"), + ] + + operations = [ + migrations.AddField( + model_name="team", + name="description", + field=models.TextField( + blank=True, + help_text="Detailed text content (plain text or HTML) shown on the public team page", + ), + ), + migrations.AddField( + model_name="team", + name="has_rich_description", + field=models.BooleanField( + default=False, help_text="True if description is raw HTML" + ), + ), + ] diff --git a/neighbourhood/models.py b/neighbourhood/models.py index f8c9970..205feca 100644 --- a/neighbourhood/models.py +++ b/neighbourhood/models.py @@ -199,6 +199,13 @@ class Team(models.Model): confirmed = models.BooleanField(default=False) status = models.CharField(max_length=300, blank=True, null=True) + description = models.TextField( + blank=True, + help_text="Detailed text content (plain text or HTML) shown on the public team page", + ) + has_rich_description = models.BooleanField( + default=False, help_text="True if description is raw HTML" + ) challenge = models.ForeignKey( Challenge, on_delete=models.SET_NULL, blank=True, null=True diff --git a/neighbourhood/templates/neighbourhood/team_public.html b/neighbourhood/templates/neighbourhood/team_public.html index f5f9870..fd3f63c 100644 --- a/neighbourhood/templates/neighbourhood/team_public.html +++ b/neighbourhood/templates/neighbourhood/team_public.html @@ -94,6 +94,14 @@

This team’s progress so far

- {% include 'neighbourhood/includes/generic_promo.html' with testimonials=1 %} + {% if team.description and team.has_rich_description %} + {% autoescape off %} + {{ team.description }} + {% endautoescape %} + {% elif team.description %} + {{ team.description|linebreaks }} + {% else %} + {% include 'neighbourhood/includes/generic_promo.html' with testimonials=1 %} + {% endif %}