Esempio n. 1
0
def formatUsedFilter():
    params = handler.getUsedFilterParams(web)
    #TODO: use ungettext for days
    #TODO: use better format for building type
    formats = {
            "maxPrice": _(u"max. %s CZK"),
            "maxUnitPrice": _(u"max. %s CZK/m²"),
            "minArea": _(u"min. %s m²"),
            "minFloor": _(u"min. %s floor"),
            "b": _(u"stavba %s"),
            "days": _(u"max. %s days old"),
        }

    parts = []
    keys = params.keys()
    if "loc" in keys:
        keys.remove("loc")

    keys.sort()
    for key in keys:
        part = formats.get(key, "%s") % params[key]
        parts.append(part)

    if "loc" in params:
        parts += handler.getFilteredLocalities(web)
    return ", ".join(parts)
Esempio n. 2
0
def htmlCheckedLoc(value):
    localities = handler.getFilteredLocalities(web)
    if value is None:
        if len(localities) == 0:
            return ' checked="checked"'
        else:
            return ""

    if value == -1:
        if len(localities) > 0:
            return ' checked="checked"'
        else:
            return ""

    if locality.LOCALITY_CHOICES[value] in localities:
        return ' checked="checked"'
    else:
        return ""
Esempio n. 3
0
def htmlFilteredLocalities():
    localities = handler.getFilteredLocalities(web)
    return ", ".join(
            web.websafe(loc).replace(" ", " ") for loc in localities)