CAVaccineInventory / vial

The Django application powering calltheshots.us

Home Page:https://vial.calltheshots.us

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/admin/core/location/lcfccy/change/ should redirect to correct page

sentry-io opened this issue · comments

Sentry Issue: VIAL-C6

ValueError: invalid literal for int() with base 10: 'lcfccy'
  File "django/db/models/fields/__init__.py", line 1823, in get_prep_value
    return int(value)

ValueError: Field 'id' expected a number but got 'lcfccy'.
(14 additional frame(s) were not displayed)
...
  File "django/db/models/sql/query.py", line 1345, in build_filter
    condition = self.build_lookup(lookups, col, value)
  File "django/db/models/sql/query.py", line 1191, in build_lookup
    lookup = lookup_class(lhs, rhs)
  File "django/db/models/lookups.py", line 25, in __init__
    self.rhs = self.get_prep_lookup()
  File "django/db/models/lookups.py", line 77, in get_prep_lookup
    return self.lhs.output_field.get_prep_value(self.rhs)
  File "django/db/models/fields/__init__.py", line 1825, in get_prep_value
    raise e.__class__(

https://vial.calltheshots.us/admin/core/location/lcfccy/change/ should redirect to the correct place

This is actually quite an easy fix, since the l in that ID means we can catch it with a separate URL regex and run some custom code to look up the correct location ID and redirect there.

https://vial.calltheshots.us/admin/core/location/rec7cOYsBzU10AONb/change/ still throws a 500 - re-opening.