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

PUTs to Site Endpoint Requires Value for time_zone #2143

Closed
zachmoody opened this issue Jun 5, 2018 · 4 comments
Closed

PUTs to Site Endpoint Requires Value for time_zone #2143

zachmoody opened this issue Jun 5, 2018 · 4 comments

Comments

@zachmoody
Copy link
Contributor

Issue type

[ ] Feature request
[X] Bug report
[ ] Documentation

Environment

  • Python version: 2.6.7
  • NetBox version: 2.4-dev, but includes previous versions as well.

Description

More details over at netbox-community/pynetbox#59, but when the time_zone field is present and null we get an error saying it can't be null. Omitting the field doesn't return an error.

@jeremystretch
Copy link
Member

I know we talked about this offline, but looking at it again I think it's a question of semantics. The time zone is stored as a string, e.g. America/New_York. Thus, a null value isn't technically valid; an empty value would be represented as an empty string instead. The same error is returned for other CharFields when a null value is passed:

{
    "facility": [
        "This field may not be null."
    ]
}

@zachmoody
Copy link
Contributor Author

Empty string works too. The only thing causing pynetbox to go sideways is that GET returns a null. So if the field goes unchanged by the user, it simply gets added as-is to the PUT.

@jeremystretch
Copy link
Member

jeremystretch commented Jun 6, 2018

The documentation for django-timezone-field states that None should be a valid value for both input and output, so let's stick with your approach.

jeremystretch added a commit that referenced this issue Jun 6, 2018
Fixes #2143 - PUTs to Site Endpoint Requires Value for time_zone
@nue-melexis
Copy link

nue-melexis commented Nov 28, 2018

Hi,

I still get this issue with version 2.4.3.
Check master commits https://github.com/digitalocean/netbox/commits/master?after=8d4329197a916ed5704ce774a77ec1f59c8a6328+279

Browsing files:
Still OK:
Post-release version bump @jeremystretch committed on Jul 2

NOK:
Closes #2211: Removed Python 2 instructions from the installation docs @jeremystretch committed on Jul 2

@jeremystretch
Can you hint me? (This history for the file at that 2 revisions deviates from March 1st)

Best Regards,
Norman

@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants