Example #1
0
def anagrafe(request):
    form = myforms.FullTextSearchForm()
    data = ''

    search_string = ""
    data_to_render = []
    order_by_field = ""
    ordering = ""

    form_dict = {
            'search_keys' : "",
            'order_by_field' : "",
            'ordering' : "",
    }

    if request.method == 'GET' and request.GET != {}:
        form = myforms.FullTextSearchForm(request.GET)
        if form.is_valid():
                form_dict['search_keys'] = form.cleaned_data['search_keys']
                form_dict['order_by_field'] = form.cleaned_data['order_by_field']
                form_dict['ordering'] = form.cleaned_data['ordering']

        data_to_render = database_manager.search_fullText(**form_dict)
        dr = data_render.DataRender(data_to_render)

        dr.selectColums(user_settings.settings_columView('anagrafe_view'))

        dr.msgItemsEmpty("<br><h3>La ricerca non ha prodotto risultati.</h3>")
        if search_string != "":
            dr.msgStatistics(("<br><h2>\"%s\" trovati:" % search_string) + " %s</h2><br>")
        dr.showStatistics()
        dr.orderUrl('anagrafe', form_dict)
        data += dr.toTable()

    return render(request, 'anagrafe.html',{'query_path':request.get_full_path(),
                                           'data': data,
                                           'data_form': form,
                                           'scripts': '',
                                           })
Example #2
0
def export_table(request):
    search_string = request.GET.get('search_keys','')
    data_table = database_manager.search_fullText(search_string)
    return __export_xls(data_table, "Anagrafe")