-
Notifications
You must be signed in to change notification settings - Fork 54
Don't raise errors when loading old objects from fixtures #76
base: master
Are you sure you want to change the base?
Don't raise errors when loading old objects from fixtures #76
Conversation
This seems to work with a VersionedManyToManyField, but needs more testing.
Hi @ezheidtmann, One question: what other scenarios require the base Thanks |
OK, so CleanerVersion is capable of storing old versions on m2m fields on old versions, but you added the exception to avoid user errors? That's great, cause that means my patch probably doesn't break huge things. :-) The only other place I've used the |
From what I can find, serialization for caching is done using the |
I've put this on my list for the week. |
Just wanted to ping @ezheidtmann about the status of getting some tests in the PR before merging code. Do you have an ETA? |
@peterfarrell I'm sorry, I didn't get to it last month and I currently don't have an ETA for tests. I wouldn't mind if you or someone else wrote them. |
@ezheidtmann - Just to confirm -- the load data issues you describe only occur on M2M in which the model has changed? I don't understand the issue enough just based on the above comments to write tests for it. Could you share an outline what you intended to do and I can get one of my team members to do it. (cc: @boydjohnson ) |
I really wish I had written those tests immediately ... I'm having trouble remembering what the problem was. I know that I was able to load a fixture full of "current" models, but then I had trouble when I added an M2M field. It may have been that the problem was just that my fixture had some non-current intermediate models; I'm not sure there's anything about M2M in particular that this fixes. I guess the test would be to generate some models, make some changes so there's some history, serialize them, delete the originals, and then deserialize them back into the database. And put an M2M field in there for good measure. |
As described in #73, I can't load fixtures for a model with a M2M field in the current version of
cleanerversion
. This PR allowsloaddata
to succeed, but I'm not sure about the consequences. And I don't know that I fully understand the need for theSuspiciousOperation
exceptions in the first place.So this is a piece for discussion. Feedback welcome, please! If this isn't obviously a bad idea, I can write some tests for it.