#29900: ForeignKey foo with to_field=bar option: Accessor should be called foo_bar not foo_id -------------------------------------+------------------------------------- Reporter: Paul | Owner: nobody Zeinlinger | Type: | Status: new Cleanup/optimization | Component: Database | Version: 2.1 layer (models, ORM) | Severity: Normal | Keywords: to_field Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- I have the following PipeItem model: {{{ class PipeItem(models.Model): entity_uuid = models.UUIDField(db_index=True, default=uuid4, editable=False) user = models.ForeignKey( User, db_column="user_entity_uuid", to_field="entity_uuid", on_delete=models.CASCADE, ) }}} Unfortunately, PipeItem.create(user_entity_uuid="XXXX") does not accept the keyword argument user_entity_uuid, but just user_id (which is an uuid in this case). I propose to change the direct accessor name to the name of the corresponding to_field.
-- Ticket URL: <https://code.djangoproject.com/ticket/29900> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/054.0a6a83580eca1d432c471b9581060e9d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.