diff options
author | Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com> | 2021-05-05 23:36:48 +0200 |
---|---|---|
committer | Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com> | 2021-05-05 23:36:48 +0200 |
commit | ba27366d9f411af56a594ccaee9895434d393ef5 (patch) | |
tree | 7e0db1afc282c7b07162c4f10f098095a70fa581 /main.py | |
parent | a463c1dc7a5b7c0e8f9d2ac8f3f3662b926ec3b1 (diff) | |
download | justice-ba27366d9f411af56a594ccaee9895434d393ef5.tar.gz |
Update form to combine foreign and domestic search
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 33 |
1 files changed, 23 insertions, 10 deletions
@@ -94,28 +94,41 @@ def search_results_entity(search): entity_number = search.entity_number_search.data entity_number_search_method = search.entity_number_search_selection.data - foreign_entity_number = search.foreign_entity_number_search.data - foreign_entity_number_search_method = search.foreign_entity_number_search_selection.data + # foreign_entity_number = search.foreign_entity_number_search.data + # foreign_entity_number_search_method = search.foreign_entity_number_search_selection.data actual_selection = search.entity_actual_selection.data qry = Pravnicka_Osoba.query if entity_number: + qry1 = Pravnicka_Osoba.query if entity_number_search_method == "text_anywhere": qry = qry.filter(Pravnicka_Osoba.ico.contains(entity_number)) + qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo.contains(entity_number)) elif entity_number_search_method == "text_beginning": qry = qry.filter(Pravnicka_Osoba.ico.like(f'{entity_number}%')) + qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo.like(f'{entity_number}%')) elif entity_number_search_method == "text_exact": qry = qry.filter(Pravnicka_Osoba.ico == entity_number) - - if foreign_entity_number: - if foreign_entity_number_search_method == "text_anywhere": - qry = qry.filter(Pravnicka_Osoba.reg_cislo.contains(foreign_entity_number)) - elif foreign_entity_number_search_method == "text_beginning": - qry = qry.filter(Pravnicka_Osoba.reg_cislo.like(f'{foreign_entity_number}%')) - elif foreign_entity_number_search_method == "text_exact": - qry = qry.filter(Pravnicka_Osoba.reg_cislo == foreign_entity_number) + qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo == entity_number) + qry = qry.union(qry1) + + # if entity_number: + # if entity_number_search_method == "text_anywhere": + # qry = qry.filter(Pravnicka_Osoba.ico.contains(entity_number)) + # elif entity_number_search_method == "text_beginning": + # qry = qry.filter(Pravnicka_Osoba.ico.like(f'{entity_number}%')) + # elif entity_number_search_method == "text_exact": + # qry = qry.filter(Pravnicka_Osoba.ico == entity_number) + + # if foreign_entity_number: + # if foreign_entity_number_search_method == "text_anywhere": + # qry = qry.filter(Pravnicka_Osoba.reg_cislo.contains(foreign_entity_number)) + # elif foreign_entity_number_search_method == "text_beginning": + # qry = qry.filter(Pravnicka_Osoba.reg_cislo.like(f'{foreign_entity_number}%')) + # elif foreign_entity_number_search_method == "text_exact": + # qry = qry.filter(Pravnicka_Osoba.reg_cislo == foreign_entity_number) if entity_name: if entity_name_search_method == "text_anywhere": |