I’m using the built in dumpdata to export the database from one server. Recently, I noticed that some datatime fields are being exported with a error because the second information is missing. For example, a entry in my auth.user is being exported as
{
"model": "auth.user",
"fields": {
"password": "",
"last_login": "2026-04-23T15:46.492Z",
"is_superuser": true,
"username": "raniere.costadasilva@gesis.org",
"first_name": "Raniere",
"last_name": "Costa da Silva",
"email": "raniere.costadasilva@gesis.org",
"is_staff": true,
"is_active": true,
"date_joined": "2024-11-21T16:24Z",
"groups": [],
"user_permissions": []
}
}
The password field was redacted in the above snippet!
Note that last_login (2026-04-23T15:46.492Z) is missing the second information. Because second information is missing, when I try to import the data, I get the error like
django.core.serializers.base.DeserializationError: Problem installing fixture '/var/app/methodshub/fixtures/production2.json': ['“2026-04-23T15:46.492Z” value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.']: (auth.user:pk=None) field_value was '2026-04-23T15:46.492Z'
I tried to reproduce in another system but I was not able to.
Anyone experienced something like this before?
Please post which versions of Python and Django you are using, which database engine, and identify any third-party packages that either provide their own version of dumpdata or override the default serializers.
I forgot to mention that I only see the problem in the JSON exported.
$ python manage.py shell
Python 3.14.4 (main, Apr 15 2026, 20:48:05) [GCC 15.2.0] on linux
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(email="raniere.costadasilva@gesis.org")
>>> u.last_login
datetime.datetime(2026, 4, 23, 15, 46, 13, 492671, tzinfo=datetime.timezone.utc)
The database engine is PostgreSQL available in the Docker image postgres:16.4-alpine3.20.
The full list of packages as reported by python -m pip freeze is
amqp==5.3.1
asgiref==3.11.1
attrs==26.1.0
beautifulsoup4==4.14.3
billiard==4.2.4
celery==5.6.3
certifi==2026.4.22
cffconvert==2.0.0
cffi==2.0.0
charset-normalizer==3.4.7
click==8.3.3
click-didyoumean==0.3.1
click-plugins==1.1.1.2
click-repl==0.3.0
cron-descriptor==1.4.5
cryptography==46.0.7
cssselect==1.4.0
Django==5.2.13
django-allauth==65.15.1
django-celery-beat==2.9.0
django-constance==4.3.5
django-extensions==4.1
django-gesis-web-frontend==1.4.0
django-guardian==3.3.1
django-markdownit==0.5.0
django-simple-history==3.11.0
django-termsandconditions==2.0.12
django-timezone-field==7.2.1
django-tomselect==2026.4.1
docker==7.1.0
docopt==0.6.2
entrypoints==0.4
escapism==1.1.0
flower==2.0.1
gunicorn==25.3.0
humanize==4.15.0
idna==3.13
iso8601==2.1.0
Jinja2==3.1.6
jsonschema==3.2.0
jupyter-repo2docker==2026.4.0
kombu==5.6.2
lxml==6.0.3
markdown-it-py==3.0.0
MarkupSafe==3.0.3
mdurl==0.1.2
nh3==0.2.22
oauthlib==3.3.1
packaging==26.1
prometheus_client==0.25.0
prompt_toolkit==3.0.52
psycopg==3.3.3
psycopg-binary==3.3.3
pycparser==3.0
PyJWT==2.12.1
pykwalify==1.8.0
pyrsistent==0.20.0
python-crontab==3.3.0
python-dateutil==2.9.0.post0
python-json-logger==4.1.0
pytz==2026.1.post1
PyYAML==6.0.3
redis==7.4.0
requests==2.33.1
ruamel.yaml==0.19.1
semver==3.0.4
setuptools==82.0.1
six==1.17.0
soupsieve==2.8.3
sqlparse==0.5.5
toml==0.10.2
tornado==6.5.5
traitlets==5.14.3
typing_extensions==4.15.0
tzdata==2026.1
tzlocal==5.3.1
urllib3==2.6.3
vine==5.1.0
wcwidth==0.6.0
I am unable to replicate this issue here by creating a new 3.14 environment with the packages you have listed - except for django-gesis-web-frontend, which doesn’t appear to be available on pypi.
This implies to me that you might have one (or more) of the following:
- A custom dumpdata command.
- A custom JSON serializer
- A custom DateTimeField
I would try accessing this same database with an empty project - no user-written code, apps, or middleware, just to verify that there’s no user-supplied code causing this.