Add nested collection management

This commit is contained in:
rucki
2026-08-30 19:27:32 +02:00
parent 5793283653
commit 7a2ce8e650
5 changed files with 44 additions and 19 deletions
+12
View File
@@ -337,10 +337,22 @@ class CollectionTests(TestCase):
CollectionSection.objects.create(collection=collection, item=note, position=0)
manage_url = reverse('collection_manage', args=[collection.id])
response = self.client.get(manage_url)
self.assertContains(response, 'id="collection-manage"')
self.assertContains(response, 'hx-boost="true"')
self.assertContains(response, 'hx-swap="outerHTML show:none"')
self.assertContains(response, f'{reverse("item_editor", args=[note.id])}?next={manage_url}')
self.assertContains(response, '>Section</')
self.assertNotContains(response, '>## Section</')
def test_collection_manage_preserves_search_when_adding_note(self):
collection = Collection.objects.create(owner=self.user, title='Reading view')
note = Item.objects.create(owner=self.user, kind=Item.Kind.NOTE, content='Findable note')
manage_url = reverse('collection_manage', args=[collection.id])
response = self.client.post(f'{manage_url}?q=Findable', {'action': 'add', 'item_id': note.id})
self.assertRedirects(response, f'{manage_url}?q=Findable')
def test_collection_can_include_collection(self):
parent = Collection.objects.create(owner=self.user, title='Parent')
child = Collection.objects.create(owner=self.user, title='Child')