Open ajslater opened 1 year ago
That seems like a reasonable use-case, tho it makes sense to add them for all the various resources (issue, publisher, character, etc). With any luck I'll have some free time next week to add it (unless someone wants to make a PR before then).
Thinking about this today, and noticed how I defined the existing urls:
app_name = "issue"
urlpatterns = [
path("create/", IssueCreate.as_view(), name="create"),
path("", IssueList.as_view(), name="list"),
path("<slug:slug>/", IssueDetail.as_view(), name="detail"),
path("<slug:slug>/update/", IssueUpdate.as_view(), name="update"),
path("<slug:slug>/delete/", IssueDelete.as_view(), name="delete"),
<snip>
And I believe by not prefixing something like detail/
before the slug I might have screwed myself since using a prefix like id/1/
I believe will use the detail view instead of redirecting . Guess I'll need to look into this further to verify it's a problem, and if I can come up with a solution that doesn't break existing urls.
https://metron.cloud/issue/SLUG/
is a user readable info pagehttps://metron.cloud/api/issue/ID/
is a JSON info page.While the JSON API results do contain a url with the slug in it, it would be very useful for clients to be able to direct users to a pretty, readable information page while knowing only the Metron ID without the client having to do an API call and parse JSON.
e.g. Some helpful person has filled in the MetronInfo.xml ID field with a metron ID. I want the Codex Comic Reader to send the user to
https://metron.cloud/issue/id/ID
(or something, anything) and have it redirect tohttps://metron.cloud/issue/SLUG/
without having to do a round trip and parse JSON. The server has all the information we need and can easily do the forward.Of course it would be extra nice for this to happen with the series id and series slug as well.