Created
December 4, 2020 08:12
-
-
Save ktechmidas/486fd318e2e1b232de301cb3298e1687 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FlightTable(tables.Table): | |
class Meta: | |
model = Flight | |
fields = ('ff_number','ff_from__fullname','ff_from__country','ff_to__fullname') | |
class FlightFilter(django_filters.FilterSet): | |
full_name = django_filters.CharFilter(field_name="ff_from__fullname", label="Search location", lookup_expr="icontains") | |
class Meta: | |
model = Flight | |
fields = ["full_name"] | |
class FlightTableView(SingleTableMixin, FilterView): | |
table_class = FlightTable | |
model = Flight | |
template_name = 'pages/flightlist.html' | |
filterset_class = FlightFilter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment