aschn / drf-tracking

Utils to track requests to Django Rest Framework API views
http://drf-tracking.readthedocs.org/
ISC License
366 stars 95 forks source link

Compatibility with Django 2.0 #85

Open marcelor opened 6 years ago

marcelor commented 6 years ago

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

marcelor commented 6 years ago

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

triat commented 6 years ago

It is actually already a warning in 1.11

Let's do a PR for that :)

avelis commented 6 years ago

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

triat commented 6 years ago

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

avelis commented 6 years ago

Thanks @triat I merged it in!

MichalGumkowski commented 6 years ago
  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

triat commented 6 years ago

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

avelis commented 6 years ago

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.

MichalGumkowski commented 6 years ago

@avelis You are correct.

ghost commented 6 years ago

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

avelis commented 6 years ago

@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.

ghost commented 6 years ago

@avelis yes I already did so. Thanks

triat commented 6 years ago

@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

webbyfox commented 6 years ago

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

luvpreetsingh commented 6 years ago

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

avelis commented 6 years ago

@luvpreetsingh You can try install the latest from source

luvpreetsingh commented 6 years ago

Thank you!