Opened 7 years ago

Closed 7 years ago

#27562 closed Uncategorized (invalid)

Django using uuid as primary key, receive AttributeError during createsuperuser(NOT AN ISSUE)

Reported by: Sean, Liu Diansheng Owned by: nobody
Component: Uncategorized Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Sean, Liu Diansheng)

I am using uuid as the primary key for my CustomerUser model which is to override the default django user. I got an AttributeError when trying to run ./manage.py createsuperuser

Here is my model.

class CustomUser(AbstractUser):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    user_type = models.CharField(max_length=1, choices=TYPE_USER, default='U')
    is_deleted = models.BooleanField(_('deleted'), default=False)

Software version: django version 1.10.2 and python version 2.7.10

And this is the exception

value = uuid.UUID(value)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/uuid.py", line 131, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'long' object has no attribute 'replace'

Change History (2)

comment:1 by Sean, Liu Diansheng, 7 years ago

Description: modified (diff)

comment:2 by Sean, Liu Diansheng, 7 years ago

Resolution: invalid
Status: newclosed
Summary: Django using uuid as primary key, receive AttributeError during createsuperuserDjango using uuid as primary key, receive AttributeError during createsuperuser(NOT AN ISSUE)
Type: BugUncategorized

I restarted mysql, delete all migrations and databases, the issue is gone.
It is not a bug.

Note: See TracTickets for help on using tickets.
Back to Top