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

No warnings for Django 1.8 #1752

Merged
merged 4 commits into from
Aug 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/nav/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def get_db_prep_value(self, value, connection, prepared=False):
else:
return super(DateTimeInfinityField, self).get_db_prep_value(
value, connection, prepared=prepared)
return connection.ops.value_to_db_datetime(value)
try:
return connection.ops.value_to_db_datetime(value) # <= 1.8
except AttributeError:
return connection.ops.adapt_datetimefield_value(value) # >= 1.9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly enough, this appears to be a no-op for the postgresql backend in Django 1.9. This function just returns its input unchanged :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh



class VarcharField(models.TextField):
Expand Down