Conversation
vjpixel
commented
Jun 21, 2026
- Add slug fields (unique, auto-generated) to Marker, Object, and Artwork models
- Add save() method to auto-generate slugs from titles with collision handling
- Add get_absolute_url() to Marker, Object, Artwork, and Exhibit models
- Add detail views: marker_detail, object_detail, artwork_detail
- Register URL patterns: markers//, objects//, artworks//
- Create Jinja2 templates for marker_detail, object_detail, artwork_detail
- Add migration 0028 to add slug fields to marker, object, and artwork tables
- Add slug fields (unique, auto-generated) to Marker, Object, and Artwork models - Add save() method to auto-generate slugs from titles with collision handling - Add get_absolute_url() to Marker, Object, Artwork, and Exhibit models - Add detail views: marker_detail, object_detail, artwork_detail - Register URL patterns: markers/<slug>/, objects/<slug>/, artworks/<slug>/ - Create Jinja2 templates for marker_detail, object_detail, artwork_detail - Add migration 0028 to add slug fields to marker, object, and artwork tables
| base_slug = slugify(self.title) or "artwork" | ||
| slug = base_slug | ||
| counter = 1 | ||
| while Artwork.objects.filter(slug=slug).exclude(pk=self.pk).exists(): | ||
| slug = f"{base_slug}-{counter}" | ||
| counter += 1 | ||
| self.slug = slug | ||
| super().save(*args, **kwargs) | ||
|
|
There was a problem hiding this comment.
Instead of using this counter in a while. If it conflicts with an existing slug, use directly the ID which is unique, not a counter in a while
There was a problem hiding this comment.
You added new URLs and views, but there is no button anywhere on the site that takes to that URL you defined as the slug, you will have to guess the slug generated for each marker/artwork/object and type it directly into the browser to go to your new page. It is basically hidden from every user besides you, IF you can guess what is the slug to type
|
Our current "details" page are the modal pages we have when the user clicks on any content. Clicking on content opens the modal page and I'm not sure if you are trying to include this new link to replace the modal or include the new links at the modal pages to "see more details" of some content. |
Resolves the conflict and the 405 it was hiding. Conflicts were additive on both sides and both sides are kept: - Marker: slug alongside in_use / is_used_by_other_user - Object: slug, save() and get_absolute_url() alongside the spritesheet fields, width and height - urls.py: both ar_view and artwork_detail imports The slug migration is renumbered 0028 -> 0045 and redepended on 0044_populate_sound_in_use_fields, because develop already carries a 0028 and two would leave the graph with conflicting leaf nodes. 0046 regenerates the pghistory triggers for the new field. Separately, the <slug:slug> detail routes were inserted alphabetically, which placed them before their literal siblings. Django matches in order and "create", "edit", "upload" and "convert-spritesheet" all satisfy the slug converter, so every POST to those endpoints resolved to a GET-only detail view and returned 405 - 49 failing tests after the merge. Each detail route now comes last within its prefix group, with a comment and a regression test asserting the resolution order. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXUw7kyELDu8ycGQxtaFbb