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

Support for UUIDs #56

Closed
justmobilize opened this issue Aug 18, 2015 · 4 comments
Closed

Support for UUIDs #56

justmobilize opened this issue Aug 18, 2015 · 4 comments

Comments

@justmobilize
Copy link

Currently UUIDs fail both in that they can't be serialized and can't be used as a pk

I fould this pull request: https://github.com/toastdriven/restless/pull/49/files
and notice that Django it self will support this in 1.8.4: https://docs.djangoproject.com/en/1.8/releases/1.8.4/

I've manually updated my urls to this:

    @classmethod
    def urls(cls, name_prefix=None):
        return patterns('',
                        url(r'^$', cls.as_list(), name=cls.build_url_name('list', name_prefix)),
                        url(r'^(?P<pk>[-\w]+)/$', cls.as_detail(), name=cls.build_url_name('detail', name_prefix)),
                        )

I'm not a regex wiz, so there might be a better one. Would love this to be build in.

@hoprocker
Copy link

More generally, the default regex for detail views is defined as (?P<pk>\d+) -- just digits -- and not as something more general (like any urlpath-valid, non-slash character). This isn't even something that you need to wait for Django 1.8.4 to see; Django currently allows defining custom User classes, and has allowed non-integer primary keys since 1.8.

I can't whip this up right now, but this should be solvable with a simple PR changing just this line.

@suchanlee
Copy link

+1 It is pretty limiting to allow queries by digits only, and querying with uuids sounds like a common enough case

@lafrech
Copy link

lafrech commented Nov 30, 2015

#49 was integrated.

@seocam
Copy link
Collaborator

seocam commented May 22, 2017

We already support UUID since version 2.0.1

@seocam seocam closed this as completed May 22, 2017
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

5 participants