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

[FAILING] Don't call get_queryset in decorators #4188

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion seed/lib/superperms/orgs/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def has_permission(self, request, view):
value_error = False
try:
if hasattr(view, 'get_queryset'):
queryset = view.get_queryset()
queryset = view.get_queryset
else:
queryset = getattr(view, 'queryset', None)
except ValueError:
Expand Down
1 change: 1 addition & 0 deletions seed/views/v3/meter_readings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def perform_create(self, serializer):
"""On create, make sure to add in the property id which comes from the URL kwargs."""

# check permissions?
self.meter_pk = self.kwargs.get('meter_pk', None)
if self.meter_pk:
serializer.save(meter_id=self.meter_pk)
else:
Expand Down
1 change: 1 addition & 0 deletions seed/views/v3/meters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def get_queryset(self):
def perform_create(self, serializer):
"""On create, make sure to add in the property id which comes from the URL kwargs."""

self.property_pk = self.kwargs.get('property_pk', None)
# check permissions?
if self.property_pk:
serializer.save(property_id=self.property_pk)
Expand Down