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 2.0 compatibility #330

Closed
brot opened this issue Dec 3, 2017 · 17 comments
Closed

Django 2.0 compatibility #330

brot opened this issue Dec 3, 2017 · 17 comments

Comments

@brot
Copy link

brot commented Dec 3, 2017

I try to update my website to Django 2.0 and got an error for simple_history/models.py

  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/db/models/base.py", line 308, in __new__
    new_class._prepare()
  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/db/models/base.py", line 363, in _prepare
    class_prepared.send(sender=cls)
  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 178, in send
    for receiver in self._live_receivers(sender)
  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 178, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/simple_history/models.py", line 94, in finalize
    history_model = self.create_history_model(sender)
  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/simple_history/models.py", line 129, in create_history_model
    fields = self.copy_fields(model)
  File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/simple_history/models.py", line 176, in copy_fields
    old_field.rel.to,
AttributeError: 'ForeignKey' object has no attribute 'rel'
@hangya
Copy link

hangya commented Dec 3, 2017

#320 also addresses this - I hope it will be merged in the near future

@whoisearth
Copy link

Just got this too after upgrade :)

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2017.2.3\helpers\pycharm\django_manage.py", line 43, in
run_module(manage_file, None, 'main', True)
File "D:\Python35\lib\runpy.py", line 205, in run_module
return run_module_code(code, init_globals, run_name, mod_spec)
File "D:\Python35\lib\runpy.py", line 96, in run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "D:\Python35\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:/Projects/enterpass/api\manage.py", line 22, in
execute_from_command_line(sys.argv)
File "D:\Python35\lib\site-packages\django\core\management_init
.py", line 371, in execute_from_command_line
utility.execute()
File "D:\Python35\lib\site-packages\django\core\management_init
.py", line 347, in execute
django.setup()
File "D:\Python35\lib\site-packages\django_init
.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\Python35\lib\site-packages\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "D:\Python35\lib\site-packages\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "D:\Python35\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 673, in exec_module
File "", line 222, in call_with_frames_removed
File "D:/Projects/enterpass/api\passwords\models.py", line 3, in
from passwordfolders.models import PasswordFolder
File "D:/Projects/enterpass/api\passwordfolders\models.py", line 31, in
register(PasswordFolder, table_name='enterpass_passwordfolderhistory')
File "D:\Python35\lib\site-packages\simple_history_init
.py", line 33, in register
records.finalize(model)
File "D:\Python35\lib\site-packages\simple_history\models.py", line 90, in finalize
history_model = self.create_history_model(sender)
File "D:\Python35\lib\site-packages\simple_history\models.py", line 125, in create_history_model
fields = self.copy_fields(model)
File "D:\Python35\lib\site-packages\simple_history\models.py", line 165, in copy_fields
old_field.rel.to,
AttributeError: 'ForeignKey' object has no attribute 'rel'

@Bernix01
Copy link

any update on this?

@Sharpek
Copy link

Sharpek commented Jan 15, 2018

+1

@mrzorn
Copy link

mrzorn commented Jan 17, 2018

+1

Any idea when this will be addressed?

@rsd
Copy link

rsd commented Jan 20, 2018

+1

2 similar comments
@kennell
Copy link
Member

kennell commented Feb 5, 2018

+1

@wontonst
Copy link

wontonst commented Feb 6, 2018

+1

@avalanchy
Copy link

avalanchy commented Feb 8, 2018

I am working on a branch django-20 for couple of days and had no trouble with Django 2.

@jhrr
Copy link

jhrr commented Feb 8, 2018

Yep, really needing this upgrade right now...

@jhrr
Copy link

jhrr commented Feb 9, 2018

There's an active PR here in case anyone is looking for unblockage.

@kennell
Copy link
Member

kennell commented Feb 9, 2018

I can vouch for the django-20 branch as a temporary fix, working without any problems so far.

@rsd
Copy link

rsd commented Feb 14, 2018

This is working for me so far:
pip install -e git+https://github.com/treyhunner/django-simple-history.git@django-20#egg=django-simple-history

@andytwoods
Copy link

Couldnt get rsd's command to work on Windows. This worked for me
pip install https://github.com/treyhunner/django-simple-history/archive/django2.0.zip

@1988gadocansey
Copy link

Excellent fix

@rossmechanic
Copy link
Collaborator

Master now supports Django 2.0. Will be releasing soon.

@rossmechanic
Copy link
Collaborator

Django 2.0 support has been released!

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

No branches or pull requests