mirror of
https://github.com/django/django.git
synced 2025-01-16 05:12:23 +00:00
596564e808
This allows using a UUIDField primary key along with the JSON session serializer. Thanks to Trac alias jamesbeith for the report and Simon Charette for the initial patch. Backport of 0f7f5bc9e7a94ab91c2b3db29ef7cf000eff593f from master
14 lines
409 B
Python
14 lines
409 B
Python
import uuid
|
|
|
|
from django.contrib.auth.models import AbstractUser
|
|
from django.contrib.auth.tests.custom_user import RemoveGroupsAndPermissions
|
|
from django.db import models
|
|
|
|
with RemoveGroupsAndPermissions():
|
|
class UUIDUser(AbstractUser):
|
|
"""A user with a UUID as primary key"""
|
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
|
|
|
class Meta:
|
|
app_label = 'auth'
|