Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL to redirects metron.cloud issue/ID to issue/SLUG #180

Open
ajslater opened this issue Sep 21, 2023 · 2 comments
Open

URL to redirects metron.cloud issue/ID to issue/SLUG #180

ajslater opened this issue Sep 21, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ajslater
Copy link

https://metron.cloud/issue/SLUG/ is a user readable info page
https://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 to https://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.

@bpepple
Copy link
Member

bpepple commented Sep 22, 2023

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).

@bpepple bpepple added the enhancement New feature or request label Sep 22, 2023
@bpepple bpepple self-assigned this Sep 22, 2023
@bpepple
Copy link
Member

bpepple commented Sep 22, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants