Add natural key support for for generic foreign keys fixtures.

35 views
Skip to first unread message

Guillaume Thomas

unread,
Jul 30, 2018, 10:14:41 AM7/30/18
to Django developers (Contributions to Django itself)
As asked by auvipy, this is a thread to discuss the implementation for this ticket. 


The idea in the proposed implementation was: When a natural key is available for a GenericForeignKey, this one is used with the field name "content_object" rather than "object_id". 

As Tim Graham pointed out, that makes the core library (which contains fixtures serializers) aware of the generic foreign keys which are in the contrib library.

In the github PR, i proposed an approach where we declare dependencies between fields (eg object_id depends on content_type) and use these deps to serialize/deserialize in the good order and benefit from natural keys if they exist.

What do you think?

Reply all
Reply to author
Forward
0 new messages