Skip to content
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

Merged
merged 4 commits into from
Jul 22, 2015

Conversation

frwickst
Copy link

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.

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling ff1ac92 on frwickst:OneToOneField-fix into 1fe9d88 on jedie:master.

@jedie
Copy link
Owner

jedie commented Jun 18, 2015

This is general a not good tested code part.
See: https://coveralls.io/builds/2847195/source?filename=reversion_compare%2Fadmin.py#L172

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
Copy link
Owner

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.

@frwickst frwickst force-pushed the OneToOneField-fix branch from ff1ac92 to 6daac59 Compare June 18, 2015 12:11
@frwickst
Copy link
Author

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).

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling 6daac59 on frwickst:OneToOneField-fix into 1fe9d88 on jedie:master.

@frwickst frwickst changed the title One to one field fix One to one field custom related name fix Jun 18, 2015
@jedie
Copy link
Owner

jedie commented Jun 18, 2015

While writing the test I noticed that the problem was not actually having a OneToOne field...

Again a new confirmation for writing unittest 👍 ;)

@frwickst
Copy link
Author

Any plans on merging this? If you want I can rebase the branch on to the current master. I rebased it on the current master and added me to the authors.

Frank Wickström added 4 commits July 22, 2015 12:04
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.
@frwickst frwickst force-pushed the OneToOneField-fix branch from 6daac59 to 7b093e3 Compare July 22, 2015 09:04
jedie added a commit that referenced this pull request Jul 22, 2015
One to one field custom related name fix
@jedie jedie merged commit 9145d83 into jedie:master Jul 22, 2015
@jedie
Copy link
Owner

jedie commented Jul 22, 2015

Thanks for the reminder!

@jedie
Copy link
Owner

jedie commented Jul 22, 2015

v0.5.4 release is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure when inspecting reverse OneToOneFields
3 participants