drf-tracking icon indicating copy to clipboard operation
drf-tracking copied to clipboard

Compatibility with Django 2.0

Open marcelor opened this issue 7 years ago • 17 comments
trafficstars

We need to add the now required on_delete attribute to the user ForeignKey in the BaseAPIRequestLog.

marcelor avatar Dec 02 '17 17:12 marcelor

Note: To get the old behavior (when using on_delete was allowed) we should use on_delete=models.CASCADE

marcelor avatar Dec 02 '17 17:12 marcelor

It is actually already a warning in 1.11

Let's do a PR for that :)

triat avatar Dec 03 '17 21:12 triat

@triat Any other compatibility issues for Django 2.0 that we need to address?

avelis avatar Dec 28 '17 05:12 avelis

I did an other PR for compatibility but not related to Django 2.0 #93

triat avatar Jan 03 '18 09:01 triat

Thanks @triat I merged it in!

avelis avatar Jan 03 '18 18:01 avelis

  File "/home/michal/Desktop/project/enviroment/lib/python3.5/site-packages/rest_framework_tracking/mixins.py", line 53, in initial
    if user.is_anonymous():
TypeError: 'bool' object is not callable

User.is_anonymous() is no longer supported as method in Django 2.0

MichalGumkowski avatar Jan 14 '18 15:01 MichalGumkowski

I'll check tomorrow if I can do an other PR, thanks @tored11

triat avatar Jan 14 '18 19:01 triat

If I understand correctly if not user.is_authenticated: is preferred. The second is that these are read-only attributes and not methods to call.

avelis avatar Jan 15 '18 16:01 avelis

@avelis You are correct.

MichalGumkowski avatar Jan 16 '18 06:01 MichalGumkowski

@triat any updates on this issue? I am having the same issue 'bool' object is not callable

ghost avatar Jan 29 '18 16:01 ghost

@ulad Not yet. The update is pretty straightforward. Just haven't had the time on hand to make a PR for review to do it. I suppose I could just edit the file directly though.

avelis avatar Jan 29 '18 16:01 avelis

@avelis yes I already did so. Thanks

ghost avatar Jan 29 '18 16:01 ghost

@avelis it seems it requires a bit more things to do (adapt tests) because if you just change it, everything crash. I started a branch to work on and add new tox tests with the new DRF and django2

triat avatar Jan 30 '18 07:01 triat

I made the pull request for "bool" object is not callable... https://github.com/aschn/drf-tracking/pull/99

webbyfox avatar Feb 26 '18 15:02 webbyfox

Is there any workaround available for this until the fix is not provided?

luvpreetsingh avatar Jun 06 '18 18:06 luvpreetsingh

@luvpreetsingh You can try install the latest from source

avelis avatar Jun 06 '18 18:06 avelis

Thank you!

luvpreetsingh avatar Jun 06 '18 18:06 luvpreetsingh