aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Šmerkl <46304018+SveterCZE@users.noreply.github.com>2021-05-08 14:02:26 +0200
committerPetr Šmerkl <46304018+SveterCZE@users.noreply.github.com>2021-05-08 14:02:26 +0200
commit83dbc0d742b4778e7e0dd8bfd30bb11e3d14a204 (patch)
treec09bf7292063866befb293a3f2e723a79b01a015
parente7a690470224c9d4d8c719a513105d1eb0d7e80e (diff)
downloadjustice-83dbc0d742b4778e7e0dd8bfd30bb11e3d14a204.tar.gz
remove duplicities in code
-rw-r--r--forms.py77
-rw-r--r--justice_build.py8
-rw-r--r--main.py8
3 files changed, 24 insertions, 69 deletions
diff --git a/forms.py b/forms.py
index b49476d..a6659cf 100644
--- a/forms.py
+++ b/forms.py
@@ -12,22 +12,13 @@ from wtforms.fields.html5 import DateField
# CREATE A GENERAL CLASS TO REMOVE DUPLICITIES?
class GeneralSearchForm(Form):
- pass
-
-class JusticeSearchForm(Form):
search_options = [("text_anywhere","Kedkoliv v textu"),
("text_beginning","Začátek výrazu"),
("text_exact","Přesný výraz"),
]
actual_options = [("actual_results","Jen platné"),
("complete_results","Platné i neplatné"),]
- nazev_subjektu = StringField(u'Název subjektu:')
- nazev_subjektu_selection = SelectField('', choices=search_options)
- nazev_search_actual = SelectField('', choices=actual_options)
- ico_search = StringField(u'Identifikační číslo:')
- ico_search_selection = SelectField('', choices=search_options)
-
obec_search = StringField(u'Obec:')
obec_search_selection = SelectField('', choices=search_options)
obec_search_actual = SelectField('', choices=actual_options)
@@ -43,7 +34,18 @@ class JusticeSearchForm(Form):
co_search = StringField(u'Číslo orientační:')
co_search_selection = SelectField('', choices=search_options)
co_search_actual = SelectField('', choices=actual_options)
+
+class JusticeSearchForm(GeneralSearchForm):
+ search_options = GeneralSearchForm.search_options
+ actual_options = GeneralSearchForm.actual_options
+ nazev_subjektu = StringField(u'Název subjektu:')
+ nazev_subjektu_selection = SelectField('', choices=search_options)
+ nazev_search_actual = SelectField('', choices=actual_options)
+
+ ico_search = StringField(u'Identifikační číslo:')
+ ico_search_selection = SelectField('', choices=search_options)
+
oddil_search = StringField(u'Oddíl:')
oddil_search_selection = SelectField('', choices=search_options)
oddil_search_actual = SelectField('', choices=actual_options)
@@ -95,14 +97,9 @@ class JusticeSearchForm(Form):
zapis_do = DateField(u'Zapsáno do:', format='%Y-%m-%d')
zapis_od = DateField(u'Zapsáno od:', format='%Y-%m-%d')
-class PersonSearchForm(Form):
- # VYMAZAT DUPLICITU
- search_options = [("text_anywhere","Kedkoliv v textu"),
- ("text_beginning","Začátek výrazu"),
- ("text_exact","Přesný výraz"),
- ]
- actual_options = [("actual_results","Jen platné"),
- ("complete_results","Platné i neplatné"),]
+class PersonSearchForm(GeneralSearchForm):
+ search_options = GeneralSearchForm.search_options
+ actual_options = GeneralSearchForm.actual_options
fist_name_search = StringField(u'Jméno:')
fist_name_search_selection = SelectField('', choices=search_options)
@@ -112,36 +109,13 @@ class PersonSearchForm(Form):
surname_search_selection = SelectField('', choices=search_options)
surname_search_actual = SelectField('', choices=actual_options)
- # Delete the duplicity
-
- obec_search = StringField(u'Obec:')
- obec_search_selection = SelectField('', choices=search_options)
- obec_search_actual = SelectField('', choices=actual_options)
-
- ulice_search = StringField(u'Ulice:')
- ulice_search_selection = SelectField('', choices=search_options)
- ulice_search_actual = SelectField('', choices=actual_options)
-
- cp_search = StringField(u'Číslo popisné:')
- cp_search_selection = SelectField('', choices=search_options)
- cp_search_actual = SelectField('', choices=actual_options)
-
- co_search = StringField(u'Číslo orientační:')
- co_search_selection = SelectField('', choices=search_options)
- co_search_actual = SelectField('', choices=actual_options)
-
person_actual_selection = SelectField('', choices=actual_options)
birthday = DateField(u'Datum narození:', format='%Y-%m-%d')
-class EntitySearchForm(Form):
- # VYMAZAT DUPLICITU
- search_options = [("text_anywhere","Kedkoliv v textu"),
- ("text_beginning","Začátek výrazu"),
- ("text_exact","Přesný výraz"),
- ]
- actual_options = [("actual_results","Jen platné"),
- ("complete_results","Platné i neplatné"),]
+class EntitySearchForm(GeneralSearchForm):
+ search_options = GeneralSearchForm.search_options
+ actual_options = GeneralSearchForm.actual_options
entity_name_search = StringField(u'Název:')
entity_name_search_selection = SelectField('', choices=search_options)
@@ -150,23 +124,6 @@ class EntitySearchForm(Form):
entity_number_search = StringField(u'IČO nebo zahraniční registrační číslo:')
entity_number_search_selection = SelectField('', choices=search_options)
- # REMOVE DUPLICITY
- obec_search = StringField(u'Obec:')
- obec_search_selection = SelectField('', choices=search_options)
- obec_search_actual = SelectField('', choices=actual_options)
-
- ulice_search = StringField(u'Ulice:')
- ulice_search_selection = SelectField('', choices=search_options)
- ulice_search_actual = SelectField('', choices=actual_options)
-
- cp_search = StringField(u'Číslo popisné:')
- cp_search_selection = SelectField('', choices=search_options)
- cp_search_actual = SelectField('', choices=actual_options)
-
- co_search = StringField(u'Číslo orientační:')
- co_search_selection = SelectField('', choices=search_options)
- co_search_actual = SelectField('', choices=actual_options)
-
entity_actual_selection = SelectField('', choices=actual_options)
class CompanyForm(Form):
diff --git a/justice_build.py b/justice_build.py
index 018e7cb..eebca0c 100644
--- a/justice_build.py
+++ b/justice_build.py
@@ -3,11 +3,9 @@ from download_files import download_data
from update_db import update_DB
def main():
- # typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
- # "oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
- # soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
- typy_po = ["as"]
- soudy = ["ceske_budejovice"]
+ typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
+ "oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
+ soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
DB_name = "justice.db"
create_DB(DB_name)
diff --git a/main.py b/main.py
index f023575..5d43f97 100644
--- a/main.py
+++ b/main.py
@@ -1,5 +1,5 @@
from app import app
-from forms import JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm, GeneralSearchForm
+from forms import GeneralSearchForm, JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm
from flask import flash, render_template, request, redirect
from models import Company, Insolvency_Events, Konkurz_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association
from models import Zakladni_Kapital, Akcie, Nazvy, Sidlo, Sidlo_Association, Pravni_Forma_Association_v2, Pravni_Formy, Statutarni_Organ_Association, Statutarni_Organy, Pocty_Clenu_Organu
@@ -14,7 +14,7 @@ from sqlalchemy import create_engine
@app.route('/', methods=['GET', 'POST'])
def index():
search = JusticeSearchForm(request.form)
- print(search)
+ # print(search)
if request.method == 'POST':
return search_results(search)
@@ -23,7 +23,7 @@ def index():
@app.route('/osoby', methods=['GET', 'POST'])
def search_person():
search = PersonSearchForm(request.form)
- print(search)
+ # print(search)
if request.method == 'POST':
return search_results_person(search)
@@ -32,7 +32,7 @@ def search_person():
@app.route('/entity', methods=['GET', 'POST'])
def search_entity():
search = EntitySearchForm(request.form)
- print(search)
+ # print(search)
if request.method == 'POST':
return search_results_entity(search)