Skip to content

Conversation

Anton-Shutik
Copy link
Contributor

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

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

@codecov
Copy link

codecov bot commented Aug 8, 2019

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.

@sliverc
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
@Anton-Shutik
Copy link
Contributor Author

@sliverc anymore blockers ?

@sliverc
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants