vittoriozamboni / django-groups-manager

Manage django groups collection based on django-mptt.
MIT License
100 stars 23 forks source link

TypeError: __init__() got an unexpected keyword argument 'load_kwargs' #50

Closed StevenMonty closed 4 years ago

StevenMonty commented 4 years ago

I noticed in #41, that you addressed an issue with line 33 in migration 0006 regarding the JSON field. I have an existing project that uses groups_manager version 1.0.2 that is working fine. However, I was doing a clean install from source to test deployment and during makemigrations, I am getting the following error: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/smontalbano/work/tmpMartie/martie_stripped/venv/lib/python3.8/site-packages/groups_manager/migrations/0006_1_0_0_default.py", line 8, in <module> class Migration(migrations.Migration): File "/home/smontalbano/work/tmpMartie/martie_stripped/venv/lib/python3.8/site-packages/groups_manager/migrations/0006_1_0_0_default.py", line 33, in Migration field=jsonfield.fields.JSONField(blank=True, default={}, load_kwargs={'object_pairs_hook': collections.OrderedDict}, verbose_name='properties'), File "/home/smontalbano/work/tmpMartie/martie_stripped/venv/lib/python3.8/site-packages/jsonfield/fields.py", line 39, in __init__ super(JSONField, self).__init__(*args, **kwargs) TypeError: __init__() got an unexpected keyword argument 'load_kwargs' I'm unsure why this error exists only when doing a clean install and not on an existing instance of the project. I even tried moving my db file into source control and skipping the migration process and going right into runserver but this error is still raised.

vittoriozamboni commented 4 years ago

Hi! Thank you for reporting the issue. I will not have access to my PC for 10 days, I will try to reproduce as soon as possible.

Can you please tell me the version of packages you had before and which one you have now?

StevenMonty commented 4 years ago

I believe I have been on version 1.0.2 the whole time since I downloaded the library around June 24, which was after 1.0.2 was released. Django version 3.0.7

StevenMonty commented 4 years ago

Update: I found that my python venv had both django-jsonfield v.1.4.0 AND jsonfield v.3.1.0 but my requirements.txt only had django-jsonfield in it which is why the clean install was raising that error, it was trying to call the constructor from the wrong library (with same name) that did not have that kwarg. Adding jsonfield to my reqs.txt fixed the issue. Sorry to bother for a rookie mistake on my end, I appreciate you getting back to me quickly.

vittoriozamboni commented 4 years ago

No worries! Thank you for reporting, I hope this will be of help for other people with the same issue!