Skip to content

Commit

Permalink
feat: Add description field on Habit
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonee committed Sep 29, 2024
1 parent 8e82902 commit 7868e73
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
18 changes: 18 additions & 0 deletions tasks/apps/tree/migrations/0039_habit_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.16 on 2024-09-29 08:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("tree", "0038_alter_habit_slug_alter_habit_tagname"),
]

operations = [
migrations.AddField(
model_name="habit",
name="description",
field=models.TextField(blank=True, null=True),
),
]
3 changes: 2 additions & 1 deletion tasks/apps/tree/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ class Habit(models.Model):
# hashtag for matching
tagname = models.SlugField(max_length=255, unique=True, allow_unicode=True)

# XXX event stream id based on name, need rehash on... other field?
event_stream_id = models.UUIDField(default=uuid.uuid4, editable=False)

description = models.TextField(null=True, blank=True)

def __str__(self):
return self.name

Expand Down
4 changes: 2 additions & 2 deletions tasks/templates/tree/habit_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ <h1>Habits</h1>
<dl>
{% for habit in object_list %}
<dt>
<strong><a href="{% url 'public-habit-detail' habit.slug %}">{{ habit.name }}</a></strong>
<strong><a href="{% url 'public-habit-detail' habit.slug %}">{{ habit.as_hashtag }}</a></strong> ({{ habit.name }})
</dt>
<dd>
{{ habit.as_hashtag }}
{{ habit.description }}
</dd>
{% endfor %}
</dl>
Expand Down

0 comments on commit 7868e73

Please sign in to comment.