Wyświetlanie danych z formularza generycznego na stronie

32 views
Skip to first unread message

Mirosław Wowczko

unread,
Feb 4, 2022, 3:30:16 PM2/4/22
to django-pl - grupa polskiej społeczności Django
Witam 
Chciałbym wyświetlić rezultat z formularza w FormView na tej same stronie co mam formularz niestety udało mi się tylko wyświetlić przefiltrowane dane przy pomocy django_filter a chciałbym użyć zwykłego formularza . Proszę o pomoc :) 

Jak to robię : 

view.py 

class ObjFilter(django_filters.FilterSet):
    class Meta:
        model = Budynek
        fields = ["ulica", "nr"]


class zasieg_uslug(ListView):
    template_name = "zasieg.html"
    model = Budynek
    filters_class = ObjFilter

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        filter = ObjFilter(self.request.GET)
        context["filter"] = filter
        return context

.html

<form action="" method="get">
{{ filter.form.as_p}}
</form>

{% for p in filter.qs %}
{{ p.usluga}}
{% endfor %}


Chciałbym do tego celu użyć FormView
Za pomoc z góry dziękuję.

Reply all
Reply to author
Forward
0 new messages