Keep in mind that obfuscation isn't security, so the answer really depend on your goal. Â Are you concerned about auto-incrementing integer IDs being sequential in REST urls? Â If so, use named slugs or UUIDs from django-extensions. Â UUIDs aren't obfuscated from a security perspective (they can be deduced), but sufficient for most purposes to make sequencing not obvious. Â You can also use the M2Crypto library to generate a random token and use that to add a home-grown access key. Â The snippet below isn't complete, but hopefully gives you an idea.
from django_extensions.db import fields as extensions
  uuid = extensions.UUIDField(
    editable=False,
    help_text="Automatically generated globally unique ID.")
  token = models.CharField(
    help_text="Automatically generated authorization token",
    max_length=255,
    editable=False, default=None, blank=True, null=True)
  def save(self, *args, **kwargs):
    """ set the authorization token on first save """
      self.token = base64.urlsafe_b64encode(
        M2Crypto.m2.rand_bytes(16))
    super(Foo, self).save(*args, **kwargs)
-- views.py --
from django.views.generic import DetailView
class FooTokenView(DetailView):
  def get_object(self):
    object = get_object_or_404(Foo,
                  uuid=self.kwargs['uuid'],
                  token=self.kwargs['token'])
    return object
---