From 4e153a969701142c00bcd09e371d256dfd2acbd7 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 19 Jun 2024 09:30:55 +0000 Subject: [PATCH] Updated documentation --- .../apis_core/apis_entities/filtersets.html | 26 ++- _modules/apis_core/generic/helpers.html | 8 +- htmlcov/class_index.html | 28 +-- htmlcov/function_index.html | 54 +++--- htmlcov/index.html | 16 +- htmlcov/manage_py.html | 4 +- htmlcov/status.json | 2 +- htmlcov/z_079cb04380c5d241_DateParser_py.html | 4 +- htmlcov/z_079cb04380c5d241___init___py.html | 4 +- .../z_079cb04380c5d241_authentication_py.html | 4 +- .../z_079cb04380c5d241_autocomplete_py.html | 4 +- htmlcov/z_079cb04380c5d241_caching_py.html | 4 +- .../z_079cb04380c5d241_filtermethods_py.html | 4 +- htmlcov/z_079cb04380c5d241_helpers_py.html | 4 +- htmlcov/z_079cb04380c5d241_normalize_py.html | 4 +- htmlcov/z_079cb04380c5d241_rdf_py.html | 4 +- htmlcov/z_079cb04380c5d241_settings_py.html | 4 +- ...z_079cb04380c5d241_test_DateParser_py.html | 4 +- .../z_079cb04380c5d241_test_caching_py.html | 4 +- ...79cb04380c5d241_test_filtermethods_py.html | 4 +- .../z_079cb04380c5d241_test_normalize_py.html | 4 +- htmlcov/z_079cb04380c5d241_test_rdf_py.html | 4 +- htmlcov/z_079cb04380c5d241_utils_py.html | 4 +- htmlcov/z_18f121dc3730a25c___init___py.html | 4 +- htmlcov/z_18f121dc3730a25c_api_views_py.html | 4 +- htmlcov/z_18f121dc3730a25c_apps_py.html | 4 +- htmlcov/z_18f121dc3730a25c_models_py.html | 4 +- .../z_18f121dc3730a25c_serializers_py.html | 4 +- htmlcov/z_18f121dc3730a25c_tables_py.html | 4 +- htmlcov/z_18f121dc3730a25c_urls_py.html | 4 +- htmlcov/z_18f121dc3730a25c_utils_py.html | 4 +- htmlcov/z_18f121dc3730a25c_views_py.html | 4 +- htmlcov/z_210622b261945b4b_apiscore_py.html | 4 +- ...619f8f35a69c2_apis_metainfo_extras_py.html | 4 +- htmlcov/z_2c9c277fca33aa93___init___py.html | 4 +- htmlcov/z_2c9c277fca33aa93_urls_py.html | 4 +- .../z_2d258017742203c3_apisgeneric_py.html | 4 +- ...3eea2897_apis_history_templatetags_py.html | 4 +- htmlcov/z_3eb2033f4386aef4___init___py.html | 4 +- htmlcov/z_3eb2033f4386aef4_apps_py.html | 4 +- htmlcov/z_3eb2033f4386aef4_models_py.html | 4 +- ...3eb2033f4386aef4_settings_loaddata_py.html | 4 +- htmlcov/z_3eb2033f4386aef4_settings_py.html | 4 +- htmlcov/z_3eb2033f4386aef4_urls_py.html | 4 +- htmlcov/z_49ff5da25a66209a___init___py.html | 4 +- htmlcov/z_49ff5da25a66209a_admin_py.html | 4 +- htmlcov/z_49ff5da25a66209a_apps_py.html | 4 +- htmlcov/z_49ff5da25a66209a_filtersets_py.html | 4 +- htmlcov/z_49ff5da25a66209a_forms_py.html | 4 +- htmlcov/z_49ff5da25a66209a_models_py.html | 4 +- .../z_49ff5da25a66209a_serializers_py.html | 4 +- htmlcov/z_49ff5da25a66209a_signals_py.html | 4 +- htmlcov/z_49ff5da25a66209a_tables_py.html | 4 +- htmlcov/z_49ff5da25a66209a_urls_py.html | 4 +- htmlcov/z_49ff5da25a66209a_views_py.html | 4 +- htmlcov/z_49ff5da25a66209a_viewsets_py.html | 4 +- htmlcov/z_572d048ccdded887___init___py.html | 4 +- htmlcov/z_572d048ccdded887_abc_py.html | 4 +- htmlcov/z_572d048ccdded887_api_views_py.html | 4 +- htmlcov/z_572d048ccdded887_apps_py.html | 4 +- .../z_572d048ccdded887_autocomplete3_py.html | 4 +- htmlcov/z_572d048ccdded887_fields_py.html | 4 +- htmlcov/z_572d048ccdded887_filtersets_py.html | 144 +++++++++------- htmlcov/z_572d048ccdded887_forms_py.html | 4 +- htmlcov/z_572d048ccdded887_models_py.html | 4 +- .../z_572d048ccdded887_serializers_py.html | 4 +- htmlcov/z_572d048ccdded887_signals_py.html | 4 +- htmlcov/z_572d048ccdded887_tables_py.html | 4 +- htmlcov/z_572d048ccdded887_urls_py.html | 4 +- htmlcov/z_572d048ccdded887_utils_py.html | 4 +- htmlcov/z_572d048ccdded887_views_py.html | 4 +- .../z_5d8b244af5c2277b_0001_initial_py.html | 4 +- ...b_0002_property_property_class_uri_py.html | 4 +- ...4af5c2277b_0003_auto_20230123_1715_py.html | 4 +- ...4af5c2277b_0004_auto_20230124_1201_py.html | 4 +- ...bj_class_alter_property_subj_class_py.html | 4 +- ...44af5c2277b_0006_versiontemptriple_py.html | 4 +- htmlcov/z_5d8b244af5c2277b___init___py.html | 4 +- htmlcov/z_73d20026d8cfd537___init___py.html | 4 +- htmlcov/z_73d20026d8cfd537_admin_py.html | 4 +- htmlcov/z_73d20026d8cfd537_apps_py.html | 4 +- htmlcov/z_73d20026d8cfd537_models_py.html | 4 +- htmlcov/z_73d20026d8cfd537_urls_py.html | 4 +- htmlcov/z_73d20026d8cfd537_views_py.html | 4 +- htmlcov/z_742a021fcfacff1d___init___py.html | 4 +- htmlcov/z_742a021fcfacff1d_admin_py.html | 4 +- htmlcov/z_742a021fcfacff1d_apps_py.html | 4 +- htmlcov/z_742a021fcfacff1d_filtersets_py.html | 4 +- htmlcov/z_742a021fcfacff1d_forms_py.html | 4 +- htmlcov/z_742a021fcfacff1d_models_py.html | 4 +- htmlcov/z_742a021fcfacff1d_signals_py.html | 4 +- htmlcov/z_742a021fcfacff1d_tables_py.html | 4 +- htmlcov/z_742a021fcfacff1d_urls_py.html | 4 +- htmlcov/z_742a021fcfacff1d_views_py.html | 4 +- .../z_754a3a2495383e43_0001_initial_py.html | 4 +- ...3_0002_remove_tempentityclass_text_py.html | 4 +- ...0003_remove_tempentityclass_source_py.html | 4 +- ...383e43_0004_delete_tempentityclass_py.html | 4 +- htmlcov/z_754a3a2495383e43___init___py.html | 4 +- .../z_782cd176b95f1058_0001_initial_py.html | 4 +- ..._0002_alter_skoscollection_options_py.html | 4 +- htmlcov/z_782cd176b95f1058___init___py.html | 4 +- .../z_917923bad02a23ec_0001_initial_py.html | 4 +- htmlcov/z_917923bad02a23ec___init___py.html | 4 +- htmlcov/z_9e462fdf71a95359___init___py.html | 4 +- htmlcov/z_9e462fdf71a95359_fields_py.html | 4 +- htmlcov/z_9e462fdf71a95359_widgets_py.html | 4 +- htmlcov/z_a87bbc0055e2906a___init___py.html | 4 +- htmlcov/z_a87bbc0055e2906a_tests_py.html | 4 +- htmlcov/z_b98ef7dc8a4f2930_mixins_py.html | 4 +- htmlcov/z_b98ef7dc8a4f2930_models_py.html | 4 +- htmlcov/z_b98ef7dc8a4f2930_views_py.html | 4 +- htmlcov/z_bacc1c03c9be4470___init___py.html | 4 +- .../z_bacc1c03c9be4470_apis_helpers_py.html | 4 +- .../z_c3a4d981b07ef925_sample_project_py.html | 4 +- ...d10b1e8419087c99_apis_templatetags_py.html | 4 +- htmlcov/z_d4c4f42115e675b2___init___py.html | 4 +- ..._d4c4f42115e675b2_apis_collections_py.html | 4 +- .../z_e42e1fb98877cc0c_0001_initial_py.html | 4 +- ...move_texttype_collections_and_more_py.html | 4 +- ...delete_vocabnames_delete_vocabsuri_py.html | 4 +- ...877cc0c_0004_delete_collectiontype_py.html | 4 +- ...77cc0c_0005_delete_vocabsbaseclass_py.html | 4 +- htmlcov/z_e42e1fb98877cc0c___init___py.html | 4 +- .../z_ef4d16bc632aabbd_0001_initial_py.html | 4 +- ...bc632aabbd_0002_auto_20220201_1241_py.html | 4 +- ...bc632aabbd_0003_auto_20220218_1530_py.html | 4 +- ...bc632aabbd_0004_auto_20230310_0804_py.html | 4 +- ...c632aabbd_0005_delete_uricandidate_py.html | 4 +- ..._ef4d16bc632aabbd_0006_delete_text_py.html | 4 +- ...f4d16bc632aabbd_0007_delete_source_py.html | 4 +- ..._alter_rootobject_self_contenttype_py.html | 4 +- ..._remove_collection_collection_type_py.html | 4 +- ...me_name_rootobject_deprecated_name_py.html | 4 +- ...1_alter_rootobject_deprecated_name_py.html | 4 +- ..._remove_rootobject_deprecated_name_py.html | 4 +- ...6bc632aabbd_0013_delete_collection_py.html | 4 +- htmlcov/z_ef4d16bc632aabbd___init___py.html | 4 +- htmlcov/z_ef777899a9cfc89e___init___py.html | 4 +- htmlcov/z_ef777899a9cfc89e_abc_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_api_views_py.html | 4 +- .../z_ef777899a9cfc89e_filterbackends_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_filtersets_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_generators_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_helpers_py.html | 162 +++++++++--------- htmlcov/z_ef777899a9cfc89e_importers_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_routers_py.html | 4 +- .../z_ef777899a9cfc89e_serializers_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_tables_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_urls_py.html | 4 +- htmlcov/z_ef777899a9cfc89e_views_py.html | 4 +- modules/apis_core.generic.html | 7 +- searchindex.js | 2 +- 153 files changed, 536 insertions(+), 485 deletions(-) diff --git a/_modules/apis_core/apis_entities/filtersets.html b/_modules/apis_core/apis_entities/filtersets.html index 4c793ec8c..42d398da4 100644 --- a/_modules/apis_core/apis_entities/filtersets.html +++ b/_modules/apis_core/apis_entities/filtersets.html @@ -93,9 +93,12 @@

Source code for apis_core.apis_entities.filtersets

 import django_filters
 from django.db import models
+from django.db.models import Q, Case, When
 from apis_core.generic.filtersets import GenericFilterSet, GenericFilterSetForm
-from apis_core.apis_relations.models import Property
+from apis_core.apis_relations.models import Property, Triple
 from apis_core.generic.helpers import generate_search_filter
+from apis_core.apis_entities.utils import get_entity_classes
+from apis_core.apis_metainfo.models import RootObject
 
 ABSTRACT_ENTITY_FILTERS_EXCLUDE = [
     "rootobject_ptr",
@@ -127,8 +130,25 @@ 

Source code for apis_core.apis_entities.filtersets

+ entities = get_entity_classes() + q = Q() + for entity in entities: + name = entity._meta.model_name + q |= Q(**{f"{name}__isnull": False}) & generate_search_filter( + entity, value, prefix=f"{name}__" + ) + all_entities = RootObject.objects_inheritance.filter(q).values_list("pk", flat=True) + t = ( + Triple.objects.filter(Q(subj__in=all_entities) | Q(obj__in=all_entities)) + .annotate( + related=Case( + When(subj__in=all_entities, then="obj"), + When(obj__in=all_entities, then="subj"), + ) + ) + .values_list("related", flat=True) + ) + return queryset.filter(pk__in=t)
diff --git a/_modules/apis_core/generic/helpers.html b/_modules/apis_core/generic/helpers.html index 897f3df61..1e4b1552a 100644 --- a/_modules/apis_core/generic/helpers.html +++ b/_modules/apis_core/generic/helpers.html @@ -103,13 +103,16 @@

Source code for apis_core.generic.helpers

 
 
[docs] -def generate_search_filter(model, query, fields_to_search=None): +def generate_search_filter(model, query, fields_to_search=None, prefix=""): """ Generate a default search filter that searches for the `query` in all the CharFields and TextFields of a model (case-insensitive) or in the fields listed in the `fields_to_search` argument. This helper can be used by autocomplete querysets if nothing fancier is needed. + If the `prefix` is set, the field names will be prefixed with that string - + this can be useful if you want to use the `generate_search_filter` in a + `Q` combined query while searching over multiple models. """ query = query.split() @@ -128,7 +131,8 @@

Source code for apis_core.generic.helpers

 
     for token in query:
         q &= functools.reduce(
-            lambda acc, field_name: acc | Q(**{f"{field_name}__icontains": token}),
+            lambda acc, field_name: acc
+            | Q(**{f"{prefix}{field_name}__icontains": token}),
             fields_to_search,
             Q(),
         )
diff --git a/htmlcov/class_index.html b/htmlcov/class_index.html
index 5df31efed..20afdffa6 100644
--- a/htmlcov/class_index.html
+++ b/htmlcov/class_index.html
@@ -55,7 +55,7 @@ 

coverage.py v7.5.3, - created at 2024-06-19 06:19 +0000 + created at 2024-06-19 09:30 +0000

@@ -265,24 +265,24 @@

100% - apis_core/apis_entities/filtersets.py - AbstractEntityFilterSetForm + apis_core/apis_entities/filtersets.py + AbstractEntityFilterSetForm 0 0 0 100% - apis_core/apis_entities/filtersets.py - AbstractEntityFilterSet + apis_core/apis_entities/filtersets.py + AbstractEntityFilterSet 0 0 0 100% - apis_core/apis_entities/filtersets.py - AbstractEntityFilterSet.Meta + apis_core/apis_entities/filtersets.py + AbstractEntityFilterSet.Meta 0 0 0 @@ -291,10 +291,10 @@

apis_core/apis_entities/filtersets.py (no class) - 17 - 17 + 20 + 20 0 - 0% + 0% apis_core/apis_entities/forms.py @@ -2877,10 +2877,10 @@

Total   - 2441 - 1022 + 2444 + 1025 0 - 58% + 58% @@ -2892,7 +2892,7 @@

coverage.py v7.5.3, - created at 2024-06-19 06:19 +0000 + created at 2024-06-19 09:30 +0000

@@ -193,28 +193,28 @@

100% - apis_core/apis_entities/filtersets.py - related_property + apis_core/apis_entities/filtersets.py + related_property 3 3 0 0% - apis_core/apis_entities/filtersets.py - related_entity - 2 - 2 + apis_core/apis_entities/filtersets.py + related_entity + 8 + 8 0 - 0% + 0% apis_core/apis_entities/filtersets.py (no function) - 17 - 17 + 20 + 20 0 - 0% + 0% apis_core/apis_entities/forms.py @@ -2273,48 +2273,48 @@

0% - apis_core/generic/helpers.py - mro_paths + apis_core/generic/helpers.py + mro_paths 4 4 0 0% - apis_core/generic/helpers.py - template_names_via_mro + apis_core/generic/helpers.py + template_names_via_mro 2 2 0 0% - apis_core/generic/helpers.py - permission_fullname + apis_core/generic/helpers.py + permission_fullname 2 2 0 0% - apis_core/generic/helpers.py - module_paths + apis_core/generic/helpers.py + module_paths 3 3 0 0% - apis_core/generic/helpers.py - import_string + apis_core/generic/helpers.py + import_string 4 4 0 0% - apis_core/generic/helpers.py - first_member_match + apis_core/generic/helpers.py + first_member_match 7 7 0 @@ -3853,10 +3853,10 @@

Total   - 3210 - 1607 + 3219 + 1616 0 - 50% + 50% @@ -3868,7 +3868,7 @@

coverage.py v7.5.3, - created at 2024-06-19 06:19 +0000 + created at 2024-06-19 09:30 +0000

@@ -121,10 +121,10 @@

apis_core/apis_entities/filtersets.py - 22 - 22 + 31 + 31 0 - 0% + 0% apis_core/apis_entities/forms.py @@ -1089,10 +1089,10 @@

Total - 3210 - 1607 + 3219 + 1616 0 - 50% + 50% @@ -1104,7 +1104,7 @@

coverage.py v7.5.3, - created at 2024-06-19 06:19 +0000 + created at 2024-06-19 09:30 +0000