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

Django 1.8: ImportError: No module named related #156

Closed
KevinGrahamFoster opened this issue Mar 3, 2015 · 8 comments · Fixed by #160
Closed

Django 1.8: ImportError: No module named related #156

KevinGrahamFoster opened this issue Mar 3, 2015 · 8 comments · Fixed by #160

Comments

@KevinGrahamFoster
Copy link
Contributor

  File "/Users/thekgf/CentriFile/allay/venv/lib/python2.7/site-packages/simple_history/models.py", line 13, in <module>
    from django.db.models.related import RelatedObject
ImportError: No module named related

Django 1.8 has made some changes here and removed the RelatedObject API. More details are here: https://docs.djangoproject.com/en/dev/releases/1.8/#model-attribute-on-private-model-relations

@macro1
Copy link
Collaborator

macro1 commented Mar 4, 2015

Yeah. I've looked a little at it, but I haven't figured out what the solution is yet. If anyone else would like to try, please feel free! @treyhunner and I will both be at PyCon in Montreal in April as well. We talked a little about doing some sprints while we're there. This may be something we work on then if it isn't fixed by then.

@KevinGrahamFoster
Copy link
Contributor Author

Hey guys, I was wondering if this change is appropriate to fix it, and if not, what the issue is with it? I see some warnings that it degraded the quality of the build, but can't find what it degraded.

#157

@macro1
Copy link
Collaborator

macro1 commented Mar 19, 2015

I know the comments are mostly from Landscape, but it's only testing code
style. It's breaking all of the builds in travis:
https://travis-ci.org/treyhunner/django-simple-history/builds/53095209

Unless those all pass we can't merge it.

On Thu, Mar 19, 2015 at 12:56 PM TheKGF notifications@github.com wrote:

Hey guys, I was wondering if this change is appropriate to fix it, and if
not, what the issue is with it? I see some warnings that it degraded the
quality of the build, but can't find what it degraded.

#157 #157


Reply to this email directly or view it on GitHub
#156 (comment)
.

@phoebebright
Copy link

FYI - I fixed another app for this with these steps:
In the imports section

replace:

        from django.db.models.related import RelatedObject

with:

        try:
           from django.db.models.related import RelatedObject as ForeignObjectRel
        except:
          # django 1.8 +
          from django.db.models.fields.related import ForeignObjectRel

And then replace all RelatedObject with ForeignObjectRel

@macro1
Copy link
Collaborator

macro1 commented Apr 9, 2015

Thanks Phoebe... Our situation was a little more complex, but it looks like
we will able to remove use of related completely (#160).
On Apr 8, 2015 1:39 PM, "Phoebe Bright" notifications@github.com wrote:

FYI - I fixed another app for this with these steps:
In the imports section
-from django.db.models.related import RelatedObject
+
+try:

  • from django.db.models.related import RelatedObject as
    ForeignObjectRel +except:
  • django 1.8 +

  • from django.db.models.fields.related import ForeignObjectRel

    the replace all RelatedObject with ForeignObjectRel


Reply to this email directly or view it on GitHub
#156 (comment)
.

@phoebebright
Copy link

Good!

@mhulse
Copy link

mhulse commented Apr 11, 2015

+1, looking forward to an update. Thanks for the awesome module. 👍 :octocat:

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

Successfully merging a pull request may close this issue.

5 participants
@phoebebright @mhulse @KevinGrahamFoster @macro1 and others