silverapp / silver

Automated billing and payments for Django with a REST API
https://www.presslabs.com/code/silver/
Other
301 stars 80 forks source link

Django Admin & Autocomplete Endpoints #667

Closed mbhassan closed 4 years ago

mbhassan commented 4 years ago

Issue in autocomplete endpoints when using django admin.

File "/usr/local/lib/python3.7/site-packages/silver/views.py", line 180, in get_queryset
django_1        |     if not (self.request.user.is_authenticated() and self.request.user.is_staff):
django_1        | TypeError: 'bool' object is not callable

self.request.user.is_authenticated() is not a function but instead an attribute.

Resolution: Should be changed to self.request.user.is_authenticated

bogdanpetrea commented 4 years ago

Hey @mbhassan , thanks for the heads-up!

You are right, from the Django docs:

Changed in Django 1.10: In older versions, this was a method. Backwards-compatibility support for using it as a method will be removed in Django 2.0.

Would you be willing to open a PR with a fix?

mbhassan commented 4 years ago

sure. ill open a pr after fixing the bug.

bogdanpetrea commented 4 years ago

Closed in #668.