Skip to content

The field _could_ be used with null=True #62

Open

Description

@aweakley

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.

Activity

  1. self-assigned this
    on Jun 13, 2024
  2. added 2 commits that reference this issue on Jun 13, 2024
  3. ColeDCrawford commented on Jun 13, 2024

    @ColeDCrawford
    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.

  4. aweakley commented on Jun 27, 2024

    @aweakley
    MemberAuthor

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions