Description
Add a block for
spdataset
For more context, this is regarding adding a deletion blocker to SpecifyUser. This operation is not currently supported with how I extended deletion blockers, but I will add a way to support adding reverse relationships so this can be added.
Spatasets
will more complicated than any other table(s) to work with on the backend. Many of Specify's internal helper functions rely on the datamodel being loaded when Specify starts up (this happens in load_datamodel.py). The issue is that to get the list of tables and fields in the database, Specify 7 reads thespecify_datamodel.xml
in the Specify 6 config directory (as seen below), and as far as I know the spdataset table is not included within that file.specify7/specifyweb/specify/load_datamodel.py
Lines 222 to 231 in 4877f75
We could manually use SQL to get the correct information, but that will only be a short-term solution (which may be fine for now). Preferably, we would want to engineer a way to load/register these Specify 7 specific tables in the internal specify datamodel. (If such a way already exists and I am overlooking it, then feel free to point it out. I have checked all attributes on specify.models and spdataset does not exist)
From #2806 (comment)
It would be nice to have a proper solution to adding these tables into the Specify datamodel, this would be beneficial both for backend use (as described above) and for frontend use.
Currently in Specify 7, users are not allowed to query on these tables that are not loaded into the datamodel, which may become an issue if tables are added solely in Specify 7.