We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sample.save() fails when the SampleType has no fields defined
test_sample = session.Sample.new( name="Test 1", description="", project="Test", sample_type=session.SampleType.find_by_name("Test Sample Type") ) print(test_sample) test_sample.save()
produces
<Sample id=None name=Test 1 sample_type={'rid': 3, 'id': 6, 'name': 'Test Sample Type', 'description': 'New sample type description', 'created_at': '2020-11-18T13:08:56.000-08:00', 'updated_at': '2020-11-18T13:08:56.000-08:00'} rid=4> Traceback (most recent call last): File "test_sample_new.py", line 16, in <module> test_sample.save() File "/usr/local/lib/python3.8/site-packages/pydent/models/sample.py", line 174, in save self.create() File "/usr/local/lib/python3.8/site-packages/pydent/models/sample.py", line 139, in create self.is_savable(do_raise=True) File "/usr/local/lib/python3.8/site-packages/pydent/models/sample.py", line 151, in is_savable for k, v in self.properties.items(): File "/usr/local/lib/python3.8/site-packages/pydent/models/sample.py", line 105, in properties return self._field_value_dictionary(lambda ft: ft.name, self._property_accessor) File "/usr/local/lib/python3.8/site-packages/pydent/models/field_value_mixins.py", line 255, in _field_value_dictionary for fv in self.field_values: TypeError: 'NoneType' object is not iterable
but when I add a field Test to the SampleType and define it in the new sample:
Test
test_sample = session.Sample.new( name="Test 1", description="", project="Test", sample_type=session.SampleType.find_by_name("Test Sample Type"), properties={"Test": "foo"} ) print(test_sample) test_sample.save()
then it works.
The text was updated successfully, but these errors were encountered:
@cashmonger can you take a look at this?
Sorry, something went wrong.
cashmonger
No branches or pull requests
Sample.save() fails when the SampleType has no fields defined
produces
but when I add a field
Test
to the SampleType and define it in the new sample:then it works.
The text was updated successfully, but these errors were encountered: