Skip to content

Add delete route for map groups and refine existing group URLs#28

Merged
pollardld merged 1 commit into
mainfrom
groupsdelete
May 28, 2026
Merged

Add delete route for map groups and refine existing group URLs#28
pollardld merged 1 commit into
mainfrom
groupsdelete

Conversation

@pollardld
Copy link
Copy Markdown
Member

Add a new route for deleting groups and correcting the patterns for listing groups.

Group management improvements:

  • Added a new URL pattern for deleting map groups, routing to DeleteMapGroupActionView with both pk and slug parameters.

URL matching fixes:

  • Fixed the group listing routes by ensuring that the show_wcoa_mapgroups view is only matched on exact URLs (/collaborate/groups/ and /groups/), preventing accidental matches with more specific group URLs.

@pollardld pollardld self-assigned this May 27, 2026
Copilot AI review requested due to automatic review settings May 27, 2026 23:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Django routing for map group management within the wcoa app by adding an explicit delete endpoint and tightening the URL patterns for the group listing views to avoid over-matching.

Changes:

  • Added a delete route for map groups that routes to DeleteMapGroupActionView with pk and slug.
  • Updated group listing routes to only match exact /collaborate/groups/ and /groups/ URLs (with optional trailing slash).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wcoa/urls.py
Comment on lines +34 to 37
re_path(r'^collaborate/groups/?(?P<pk>\d+)/(?P<slug>[\w-]+)/delete/?$', groupviews.DeleteMapGroupActionView.as_view(), name='delete'),
re_path(r'^collaborate/groups/?(?P<pk>\d+)/(?P<slug>[\w-]+)/edit/?', views.show_wcoa_edit_mapgroups, name='edit'),
re_path(r'^collaborate/groups/?(?P<pk>\d+)/(?P<slug>[\w-]+)/preferences/?$', MapGroupPreferencesView.as_view(), name='preferences'),
re_path(r'^collaborate/groups/?(?P<pk>\d+)/(?P<slug>[\w-]+)/?$', views.show_wcoa_detail_mapgroups, name='detail'),
@pollardld pollardld merged commit 1e62b9f into main May 28, 2026
1 check passed
@pollardld pollardld deleted the groupsdelete branch May 28, 2026 00:14
Comment thread wcoa/urls.py
re_path(r'^collaborate/groups/?(?P<pk>\d+)/(?P<slug>[\w-]+)/?$', views.show_wcoa_detail_mapgroups, name='detail'),
re_path(r'^collaborate/groups/?', views.show_wcoa_mapgroups, name='show_wcoa_mapgroups'),
re_path(r'^groups/?', views.show_wcoa_mapgroups, name='show_wcoa_mapgroups'),
re_path(r'^collaborate/groups/?$', views.show_wcoa_mapgroups, name='show_wcoa_mapgroups'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a strong need to enforce URL end here with $? I can see tradeoffs with adding it:

  • Pro: potential future URL flow confusion can be avoided, especially highlighting typos
  • Con: less elegant failure - goes to error instead of failing gracefully back to the (collaborate/)groups/page.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I see how this interplays with the new line you added: if the PK or the slug does not exist, then the DELETE API instead might return someone (depending on how mismatches are handled) to the Groups page without an error. I can see that being confusing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants