﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34918	Assigning model instance to `_id`/attname field saves correctly, but breaks accessing the field	Ricardo Busquet	nobody	"Model definition:

{{{#!python
class Author(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)

class Book(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    author = models.ForeignKey(
        Author, null=True, blank=True, on_delete=models.CASCADE
    )
}}}

{{{#!python
In [1]: book = Book.objects.create()

In [2]: author = Author.objects.create()

In [3]: book.author_id

In [4]: book.author

In [5]: book.author_id = author

In [6]: book.save()

In [7]: book.author
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
...
ValidationError: ['“Author object (caaf8f9a-f934-44e9-8e6b-00d71d116acf)” is not a valid UUID.']
}}}

Similarly, if someone tries to use `book.author_id` to fetch an author using `Author.objects.get(id=book.author_id)` will also fail with a similar error."	Bug	closed	Database layer (models, ORM)	4.2	Normal	invalid			Unreviewed	0	0	0	0	0	0
