Skip to content

Commit

Permalink
Teams can now have a custom description / HTML content
Browse files Browse the repository at this point in the history
  • Loading branch information
zarino committed Oct 4, 2024
1 parent ded40aa commit 83dfc48
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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"
),
),
]
7 changes: 7 additions & 0 deletions neighbourhood/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion neighbourhood/templates/neighbourhood/team_public.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ <h2>This team’s progress so far</h2>

<div class="container py-4 py-lg-5">

{% 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 %}

</div>

0 comments on commit 83dfc48

Please sign in to comment.