Skip to content

Instantly share code, notes, and snippets.

@diek
Last active February 11, 2025 19:31
Show Gist options
  • Save diek/d4c892d5800ed2c0f6b035dc14e4bb12 to your computer and use it in GitHub Desktop.
Save diek/d4c892d5800ed2c0f6b035dc14e4bb12 to your computer and use it in GitHub Desktop.
Add drivers
from formulaone.models import Circuit, Constructor, Driver, IncidentReport, Race, Result, Status
# Shell Plus Django Imports
from django.core.cache import cache
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from django.db.models import Avg, Case, Count, F, Max, Min, Prefetch, Q, Sum, When
from django.utils import timezone
from django.urls import reverse
from django.db.models import Exists, OuterRef, Subquery
Python 3.13.2 (main, Feb 5 2025, 19:15:50) [Clang 19.1.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> reports = IncidentReport.objects.all()
>>> count = 0
>>> for report in reports:
... count+=1
...
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/derrick/workspace/django_stuff/formula1_orm/.venv/lib/python3.13/site-packages/django/db/models/query.py", line 400, in __iter__
self._fetch_all()
~~~~~~~~~~~~~~~^^
File "/Users/derrick/workspace/django_stuff/formula1_orm/.venv/lib/python3.13/site-packages/django/db/models/query.py", line 1928, in _fetch_all
self._result_cache = list(self._iterable_class(self))
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/derrick/workspace/django_stuff/formula1_orm/.venv/lib/python3.13/site-packages/django/db/models/query.py", line 123, in __iter__
for row in compiler.results_iter(results):
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/derrick/workspace/django_stuff/formula1_orm/.venv/lib/python3.13/site-packages/django/db/models/sql/compiler.py", line 1512, in apply_converters
value = converter(value, expression, connection)
File "/Users/derrick/workspace/django_stuff/formula1_orm/.venv/lib/python3.13/site-packages/django/db/backends/sqlite3/operations.py", line 336, in converter
return create_decimal(value).quantize(
~~~~~~~~~~~~~~^^^^^^^
TypeError: argument must be int or float
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment