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

The field _could_ be used with null=True #62

Open
aweakley opened this issue Jun 13, 2024 · 2 comments
Open

The field _could_ be used with null=True #62

aweakley opened this issue Jun 13, 2024 · 2 comments
Assignees

Comments

@aweakley
Copy link
Member

Here my code assumes that natural_text will never be None,

if natural_text == "":
but I think if for some reason you decided to use null=True on your field then it could be None.

@aweakley aweakley self-assigned this Jun 13, 2024
aweakley added a commit that referenced this issue Jun 13, 2024
aweakley added a commit that referenced this issue Jun 13, 2024
@ColeDCrawford
Copy link
Contributor

Somewhat related: I updated a project that was using EDTF v4 to test out the v5 branch and hit this error:

  File "<...>/site-packages/edtf/fields.py", line 123, in update_values
    direct_input = getattr(instance, self.direct_input_field, "")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: attribute name must be string, not 'NoneType'

This is because I didn't have a direct_input_field defined. Is it reasonable to assume that implementers will have that field, or should we update the fields.py to handle this more gracefully? We should at least call it out in the readme and release notes.

@aweakley
Copy link
Member Author

I've made a PR #68 to add some Django checks for the field.

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

No branches or pull requests

2 participants