#30006: Wrong UUID serialization in inline admin when used as a 1to1Field
primary
key of a UUID primary key.
-----------------------------------------+------------------------
Reporter: Gerhut | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Sorry for the confusing title, I create a reproducing
[https://github.com/Gerhut/django-inline-admin-bug repo] on GitHub.
Key code as follows:
models.py
{{{
class Room(models.Model):
id = models.UUIDField(default=uuid4, primary_key=True, editable=False)
name = models.TextField()
def __str__(self):
return self.name
class Teacher(models.Model):
room = models.OneToOneField(Room, on_delete=models.CASCADE,
primary_key=True)
name = models.TextField()
def __str__(self):
return self.name
class Student(models.Model):
id = models.UUIDField(default=uuid4, primary_key=True, editable=False)
teacher = models.ForeignKey(Teacher, on_delete=models.CASCADE)
name = models.TextField()
def __str__(self):
return self.name
}}}
admin.py
{{{
from .models import Room, Teacher, Student
@admin.register(Room)
class RoomAdmin(admin.ModelAdmin):
pass
@admin.register(Teacher)
class TeacherAdmin(admin.ModelAdmin):
class StudentInline(admin.TabularInline):
model = Student
inlines = [StudentInline]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30006>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.211ad9b532f163fef0e62730191fcc95%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.