-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One to one field custom related name fix #42
Conversation
This is general a not good tested code part. Can you add unittests for this?!? |
@@ -106,9 +107,15 @@ def get_related(self): | |||
|
|||
def get_reverse_foreign_key(self): | |||
obj = self.version.object_version.object | |||
# self = getattr(obj, self.field.related_name) #self.field.field_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this line is not needed anymore, it should be deleted.
ff1ac92
to
6daac59
Compare
While writing the test I noticed that the problem was not actually having a OneToOne field, but a combination of a OneToOne field and having a custom related name on that field. I modified the branch and added a failing test (that works after the fix). |
Again a new confirmation for writing unittest 👍 ;) |
Any plans on merging this? |
The identity model includes an id_number which is set to char field and a OneToOne field to a user. Note that the field also sets a custom related name. This is to test that we can handle custom related names in one to one fields.
…f all() A OneToOne field does not have a all() function, which leads to an exception when all() is called.
6daac59
to
7b093e3
Compare
One to one field custom related name fix
Thanks for the reminder! |
v0.5.4 release is out. |
The code is almost the same as @aemdy fix, https://github.com/aemdy/django-reversion-compare/commit/da60d7873bbd8fb212f7f076a68b0b52e297796e. Just a bit more nicely structured and with a proper commit message.
This should fix: #36
Note that there are other problems in the code base that will most likely cause a comparison to still fail, such as #41.