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

Fixes bug with foreign keys to one-to-one fields #55

Merged
merged 4 commits into from
Jul 28, 2013

Conversation

daniell
Copy link
Contributor

@daniell daniell commented Jun 17, 2013

django-simple-history throws an exception when it finds a foreign key to a one-to-one field.

For example, the code below will raise an assertion error saying that a 'NoneType' object has no attribute 'to':

from django.contrib.auth.models import User
from django.db import models
from simple_history.models import HistoricalRecords

class AdminUser(User):
    #The primary key of this model is a OneToOne field to User
    pass

class UserProfile(models.Model)
    user = models.FoerignKey(AdminUser)
    history = HistoricalRecords() 

This fixes the issue.

@treyhunner
Copy link
Member

Thanks for the tests and the fix!

treyhunner added a commit that referenced this pull request Jul 28, 2013
Fixes bug with foreign keys to one-to-one fields
@treyhunner treyhunner merged commit 9142aeb into jazzband:master Jul 28, 2013
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.

None yet

2 participants