diff options
author | luxagraf <sng@luxagraf.net> | 2024-01-27 15:16:24 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2024-01-27 15:16:24 -0600 |
commit | 3562e295581d733039df0b72da3c993139cd5949 (patch) | |
tree | 1b4117324c95e3349f042a47b7f722340f898755 | |
parent | e6a696797ecacd705251b00f2a4863b1237889aa (diff) |
gtd: sorted project detail view by note type
-rw-r--r-- | app/gtd/models.py | 3 | ||||
-rw-r--r-- | app/gtd/templates/gtd/project_detail.html | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/gtd/models.py b/app/gtd/models.py index 457083f..2ea18ab 100644 --- a/app/gtd/models.py +++ b/app/gtd/models.py @@ -134,6 +134,9 @@ class GTDNote(models.Model): def __str__(self): return self.title + def get_note_type(self): + return self.get_note_type_display() + def save(self, *args, **kwargs): self.body_html = markdown_to_html(self.body_markdown) super(GTDNote, self).save(*args, **kwargs) diff --git a/app/gtd/templates/gtd/project_detail.html b/app/gtd/templates/gtd/project_detail.html index 844a120..d9a5657 100644 --- a/app/gtd/templates/gtd/project_detail.html +++ b/app/gtd/templates/gtd/project_detail.html @@ -1,5 +1,6 @@ {% extends 'base_gtd.html' %} {% load typogrify_tags %} +{% load get_note_type %} {% block extrahead %} <style> .detail-header { @@ -16,13 +17,16 @@ </div> <div class="post-body"> {{object.body_html|smartypants|safe}} - <h4>Actions</h4> - <div class="note-list">{% for object in object.gtdnote_set.all %}<article> - <h2>{% if object.url %}<a href="{{object.url}}">{{object.title}}</a>{%else%}{{object.title}}{%endif%} <span class="note-edit"><a href="{%url 'gtd:note-edit' object.pk%}">edit</a></span></h2> + {% regroup object.gtdnote_set.all by note_type as type_list %} + {% for type in type_list %} + <h4>{% get_note_type type.grouper %}</h4> + <div class="note-list">{% for object in type.list %}<article> + <h2>{% if object.url %}<a href="{{object.url}}">{{object.title}}</a>{%else%}{{object.title}}{%endif%} <span class="note-edit"><a href="{%url 'gtd:note-edit' object.pk%}">edit</a></span></h2> {{object.body_html|smartypants|safe}} - <p class="small">{{object.get_status_display}}</p> + {% if object.get_status_display != 'None' %}<p class="small">{{object.get_status_display}}</p>{% endif %} <p class="small"><a href="{% url 'gtd:note-delete' object.pk %}">delete</a></p></article> {% endfor %}</div> +{% endfor %} </div> </main> {% endblock %} |