Cannot assign playlist to timeslot
When I try to assign a schedule to a timeslot, I receive an Internal Server Error from steering
which is as follows:
ValueError at /api/v1/shows/2/schedules/27/timeslots/162/
Cannot use None as a query value
Request Method: PUT
Request URL: http://127.0.0.1:8000/api/v1/shows/2/schedules/27/timeslots/162/
Django Version: 2.2.12
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/core/handlers/exception.py" in inner
response = get_response(request)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
response = wrapped_callback(request, callback_args, *callback_kwargs)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/views/decorators/csrf.py" in wrapped_view
return view_func(args, *kwargs)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/viewsets.py" in view
return self.dispatch(request, args, *kwargs)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/views.py" in dispatch
response = self.handle_exception(exc)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/views.py" in handle_exception
self.raise_uncaught_exception(exc)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/views.py" in raise_uncaught_exception
raise exc
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/views.py" in dispatch
self.initial(request, args, *kwargs)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/views.py" in initial
self.check_permissions(request)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/views.py" in check_permissions
if not permission.has_permission(request, self):
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/permissions.py" in has_permission
queryset = self._queryset(view)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/rest_framework/permissions.py" in _queryset
queryset = view.get_queryset()
File "/Users/pretzelhands/Projects/aura/steering/program/views.py" in get_queryset
return TimeSlot.objects.filter(show=show_pk, schedule=schedule_pk, start__gte=start, end__lte=end).order_by('start')
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/manager.py" in manager_method
return getattr(self.get_queryset(), name)(args, *kwargs)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/query.py" in filter
return self._filter_or_exclude(False, args, *kwargs)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/query.py" in _filter_or_exclude
clone.query.add_q(Q(args, *kwargs))
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/sql/query.py" in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/sql/query.py" in _add_q
child_clause, needed_inner = self.build_filter(
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/sql/query.py" in build_filter
condition = self.build_lookup(lookups, col, value)
File "/Users/pretzelhands/.pyenv/versions/aura-steering/lib/python3.8/site-packages/django/db/models/sql/query.py" in build_lookup
raise ValueError("Cannot use None as a query value"
The request that has been sent was as follows:
{
"id": 162,
"show": 2,
"schedule": 27,
"start": "2020-12-08T07:00:00",
"end": "2020-12-08T08:00:00",
"memo": "",
"is_repetition": false,
"playlist_id": 8,
"note_id": null
}
This seems to work for David, even though he also receives a 500 error as depicted in this screenshot. From what I can tell it seems to be a slightly different error. (IndexError
vs ValueError
)
It seems that either I'm missing some value or an internal value isn't being set correctly before the SQL query related to this action happens? That's my best guess, but it's been years since I've done any Django.