Skip to content

Commit

Permalink
Update to make morphodict compatible with django 4.2
Browse files Browse the repository at this point in the history
There is one breaking change in the upgrade that impacts search and had to be tweaked.
We use synthetic wordforms to add inflected entries that could or could not have definitions in the dictionary.
This means that the entries may or may not exist.
Previously, django silently accepted non-existing entries.
This is no longer the case, and the search produces a value error as we can't
find the wordform in the dictionary (when either serializing or prefetching related fields).
Solution:  Only prefetch and serialize if the element actually exists.

We use the _state flags as discussed in
https://docs.djangoproject.com/en/4.2/ref/models/instances/#django.db.models.Model._state

TODO: Ensure that we actually search when a variant does have a definition.
Add a test for this.
  • Loading branch information
fbanados committed Aug 17, 2024
1 parent df076a2 commit 247938e
Show file tree
Hide file tree
Showing 4 changed files with 898 additions and 805 deletions.
3 changes: 1 addition & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ myst-parser = "*"
colorama = "~=0.4"
coverage = "*"
cree-sro-syllabics = ">=2020.6.23"
pytz = "==2019.2"
Django = "~=3.2"
Django = "~=4.2"
typing-extensions = "~=4.0"
attrs = "~=23.2"
django-js-reverse = "~=0.9"
Expand Down
Loading

0 comments on commit 247938e

Please sign in to comment.