Skip to content

修复获取单个记录时引发select all的问题 #589

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

Merged
merged 1 commit into from
Jun 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions xadmin/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,10 @@ def get_object(self, object_id):
Get model object instance by object_id, used for change admin view
"""
# first get base admin view property queryset, return default model queryset
queryset = self.queryset()
model = queryset.model
model = self.model
try:
object_id = model._meta.pk.to_python(object_id)
return queryset.get(pk=object_id)
return model.objects.get(pk=object_id)
except (model.DoesNotExist, ValidationError):
return None

Expand Down