#34918: Assigning model instance to `_id`/attname field saves correctly, but breaks accessing the field -------------------------------------+------------------------------------- Reporter: Ricardo Busquet | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 4.2 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Rahul Beniwal): Hi Ricardo Busquet I checked this, and you are right. But instead of assigning `book.author_id=author` to `book.author=author` it seems to be working fine. {{{#!python In [23]: book.author = author In [24]: book.save() In [25]: book.author_id Out[25]: UUID('857acf04-960a-40ae-9c85-8c363b0a0dfd') In [26]: book.author Out[26]: <Author: Author object (857acf04-960a-40ae-9c85-8c363b0a0dfd)> In [27]: Author.objects.get(id=book.author_id) Out[27]: <Author: Author object (857acf04-960a-40ae-9c85-8c363b0a0dfd)> }}} Can we update the documentation for the UUID field to aware reader about this situation or code level changes are needed? Please feel free to assign this to me -- Ticket URL: <https://code.djangoproject.com/ticket/34918#comment:1> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018b50770768-ca7f4e5e-1af6-4996-9523-ac823a144e6b-000000%40eu-central-1.amazonses.com.