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

Rename slug to id? #111

Open
nuwang opened this issue Oct 24, 2017 · 3 comments
Open

Rename slug to id? #111

nuwang opened this issue Oct 24, 2017 · 3 comments

Comments

@nuwang
Copy link
Member

nuwang commented Oct 24, 2017

Some primary keys use slug and others use id, which makes writing client code difficult, since you have to know in advanced whether an object is using slug or id. Since it doesn't matter whether the pk is a slug or not as it's autogenerated from the name anyway, it seems better to rename everything to ID.

@afgane
Copy link
Contributor

afgane commented Oct 24, 2017

One reason for going down the slug path may be readability of the URLs, if we care about that. The ID's typically result in shorter URLs but they do expose a bit more about the deployment so perhaps should be encoded... Having said that, I don't have a strong opinion one way or another.

@nuwang
Copy link
Member Author

nuwang commented Oct 24, 2017

What I meant was that we keep using a slug, but rename slug->id. That way, we can still have friendly urls etc., but we can always refer to an object's id by id, rather than having to switch between slug and id. So application.slug becomes application.id, but remains a slug value.

@afgane
Copy link
Contributor

afgane commented Jan 30, 2019

In light of #159, renaming to id makes even more sense.

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

No branches or pull requests

2 participants