Opened 6 years ago

Last modified 3 years ago

#29738 closed Bug

Django can't serialize DateTimeTZRange(lower=None, upper=None, bounds='[)') — at Initial Version

Reported by: Graham Mayer Owned by: nobody
Component: Migrations Version: 2.0
Severity: Normal Keywords: rangefield postgresql psycopg2 migrations removed
Cc: jon.dufresne@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Tried to use DateTimeTZRange(lower=None, upper=None, bounds='[)') as a default for a model field and get the following error when running 'python manage.py makemigrations':

Traceback (most recent call last):

File "manage.py", line 12, in <module>

execute_from_command_line(sys.argv)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/core/management/init.py", line 371, in execute_from_command_line

utility.execute()

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/core/management/init.py", line 365, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv

self.execute(*args, cmd_options)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute

output = self.handle(*args, options)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 172, in handle

self.write_migration_files(changes)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 210, in write_migration_files

migration_string = writer.as_string()

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/writer.py", line 151, in as_string

operation_string, operation_imports = OperationWriter(operation).serialize()

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/writer.py", line 110, in serialize

_write(arg_name, arg_value)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/writer.py", line 74, in _write

arg_string, arg_imports = MigrationWriter.serialize(_arg_value)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/writer.py", line 279, in serialize

return serializer_factory(value).serialize()

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/serializer.py", line 203, in serialize

return self.serialize_deconstructed(path, args, kwargs)

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/serializer.py", line 90, in serialize_deconstructed

arg_string, arg_imports = serializer_factory(arg).serialize()

File "/home/grahammayer/logimeter/logimeter/lib/python3.6/site-packages/django/db/migrations/serializer.py", line 370, in serializer_factory

"topics/migrations/#migration-serializing" % (value, get_docs_version())

ValueError: Cannot serialize: DateTimeTZRange(None, None, '[)')

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top