Improve task filters and tag collections

This commit is contained in:
rucki
2026-09-04 11:44:49 +02:00
parent e04385c23d
commit c6309cabd8
12 changed files with 342 additions and 13 deletions
+16
View File
@@ -215,6 +215,10 @@ class Collection(models.Model):
visibility = models.CharField(max_length=10, choices=Item.Visibility.choices, default=Item.Visibility.PRIVATE)
mode = models.CharField(max_length=10, choices=Mode.choices, default=Mode.MANUAL)
filter_tags = models.ManyToManyField(Tag, blank=True, related_name='tag_collections')
include_notes = models.BooleanField(default=True)
include_todos = models.BooleanField(default=False)
include_links = models.BooleanField(default=False)
include_journal = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
@@ -227,6 +231,18 @@ class Collection(models.Model):
def get_absolute_url(self):
return reverse('collection_detail', args=[self.pk])
def included_item_kinds(self):
kinds = []
if self.include_notes:
kinds.append(Item.Kind.NOTE)
if self.include_todos:
kinds.append(Item.Kind.TODO)
if self.include_links:
kinds.append(Item.Kind.LINK)
if self.include_journal:
kinds.append(Item.Kind.JOURNAL)
return kinds or [Item.Kind.NOTE]
class CollectionSection(models.Model):
collection = models.ForeignKey(Collection, on_delete=models.CASCADE, related_name='sections')