Exemple #1
0
def get_addresses_model(parent: QObject = None) -> QSqlQueryModel:
    model = QSqlQueryModel(parent)
    model.setQuery("SELECT distinct address FROM public.customers;")
    if model.lastError().isValid():
        raise RuntimeError(model.lastError().text())
    return model
Exemple #2
0
def get_discount_groups_model(parent: QObject = None) -> QSqlQueryModel:
    model = QSqlQueryModel(parent)
    model.setQuery("SELECT distinct discount_group FROM public.merchandise;")
    if model.lastError().isValid():
        raise RuntimeError(model.lastError().text())
    return model