开发者

Any django reversion tools which follow ContentTypes GenericForeignKey?

开发者 https://www.devze.com 2023-02-26 18:13 出处:网络
I\'m trying to use django-reversion on a project that also uses a GenericForeignKey. I开发者_开发百科 want the reversion to follow the generic link. I can\'t seem to get it working, and as there seems

I'm trying to use django-reversion on a project that also uses a GenericForeignKey. I开发者_开发百科 want the reversion to follow the generic link. I can't seem to get it working, and as there seems to be no mention of ContentTypes on the django-reversion documentation, I wonder if it's possible. Any ideas?

EDIT: To anyone following this path, I ended up doing manual management of my revision session and adding the relevant objects to the reversion, no need to get django-reversion to automatically follow the object graph.


This doesn't answer the direct question, but it answers the problem we were trying to solve.

ContentTypes is fragile because of the contenttypes table's ids.

In our case we ended up storing the set of related objects which we wanted to version in sync in a JSON structure in a database field. We decided it was a good idea to store any group of related objects that get versioned in one very 'contained' well defined place.

0

精彩评论

暂无评论...
验证码 换一张
取 消