Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use "ObjectDoesNotExist" from model_class #683

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

Closed
Anton-Shutik wants to merge 0 commits into django-json-api:master from Anton-Shutik:master

Conversation

Copy link
Contributor

@Anton-Shutik Anton-Shutik commented Aug 8, 2019
edited
Loading

Fixes #

File "/home/anton/.virtualenvs/epantry/lib/python3.6/site-packages/rest_framework/serializers.py", line 748, in is_valid
 self._validated_data = self.run_validation(self.initial_data)
File "/home/anton/.virtualenvs/epantry/lib/python3.6/site-packages/rest_framework/serializers.py", line 626, in run_validation
 value = self.to_internal_value(data)
File "/home/anton/.virtualenvs/epantry/lib/python3.6/site-packages/rest_framework/serializers.py", line 665, in to_internal_value
 validated = self.child.run_validation(item)
File "/home/anton/.virtualenvs/epantry/lib/python3.6/site-packages/rest_framework/fields.py", line 535, in run_validation
 value = self.to_internal_value(data)
File "/home/anton/projects/ePantry/epantry/django-rest-framework-json-api/rest_framework_json_api/serializers.py", line 49, in to_internal_value
 except ObjectDoesNotExist:
NameError: name 'ObjectDoesNotExist' is not defined

Description of the Change

Looks like ObjectDoesNotExist is not imported in the module and it fails whenever return self.model_class.objects.get(pk=pk) raises an exception

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

Copy link

codecov bot commented Aug 8, 2019
edited
Loading

Codecov Report

Merging #683 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@
## master #683 +/- ##
==========================================
+ Coverage 95.96% 95.98% +0.01% 
==========================================
 Files 54 54 
 Lines 2728 2737 +9 
==========================================
+ Hits 2618 2627 +9 
 Misses 110 110
Impacted Files Coverage Δ
example/tests/test_serializers.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c6cceb...cbcb6e2. Read the comment docs.

Copy link
Member

sliverc commented Aug 9, 2019

The change looks good. Could you follow up on the other points on the check list (especially writing a test)? Thanks.

@Anton-Shutik Anton-Shutik force-pushed the master branch 2 times, most recently from 065e777 to cbcb6e2 Compare August 12, 2019 08:32
Copy link
Contributor Author

@sliverc anymore blockers ?

Copy link
Member

sliverc commented Aug 15, 2019

Mistakenly pushed the wrong branch when updating the PR with a changelog entry.

Change looks good though so I have opened another PR #690 including these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /