mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Rename roster methods in portal view
This commit is contained in:
@@ -3,7 +3,7 @@ from django.urls import path
|
|||||||
from portal.views import (
|
from portal.views import (
|
||||||
GetData,
|
GetData,
|
||||||
GetRoster,
|
GetRoster,
|
||||||
GetRosterFiltered,
|
GetObjectsFiltered,
|
||||||
GetFlatpage,
|
GetFlatpage,
|
||||||
GetRollingStock,
|
GetRollingStock,
|
||||||
GetConsist,
|
GetConsist,
|
||||||
@@ -14,7 +14,7 @@ from portal.views import (
|
|||||||
Types,
|
Types,
|
||||||
Books,
|
Books,
|
||||||
GetBook,
|
GetBook,
|
||||||
SearchRoster,
|
SearchObjects,
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
@@ -95,22 +95,22 @@ urlpatterns = [
|
|||||||
path("bookshelf/book/<uuid:uuid>", GetBook.as_view(), name="book"),
|
path("bookshelf/book/<uuid:uuid>", GetBook.as_view(), name="book"),
|
||||||
path(
|
path(
|
||||||
"search",
|
"search",
|
||||||
SearchRoster.as_view(http_method_names=["post"]),
|
SearchObjects.as_view(http_method_names=["post"]),
|
||||||
name="search",
|
name="search",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"search/<str:search>/<int:page>",
|
"search/<str:search>/<int:page>",
|
||||||
SearchRoster.as_view(),
|
SearchObjects.as_view(),
|
||||||
name="search_pagination",
|
name="search_pagination",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"<str:_filter>/<str:search>",
|
"<str:_filter>/<str:search>",
|
||||||
GetRosterFiltered.as_view(),
|
GetObjectsFiltered.as_view(),
|
||||||
name="filtered",
|
name="filtered",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"<str:_filter>/<str:search>/<int:page>",
|
"<str:_filter>/<str:search>/<int:page>",
|
||||||
GetRosterFiltered.as_view(),
|
GetObjectsFiltered.as_view(),
|
||||||
name="filtered_pagination",
|
name="filtered_pagination",
|
||||||
),
|
),
|
||||||
path("<uuid:uuid>", GetRollingStock.as_view(), name="rolling_stock"),
|
path("<uuid:uuid>", GetRollingStock.as_view(), name="rolling_stock"),
|
||||||
|
@@ -83,7 +83,7 @@ class GetRoster(GetData):
|
|||||||
queryset = RollingStock.objects.order_by(*order_by_fields())
|
queryset = RollingStock.objects.order_by(*order_by_fields())
|
||||||
|
|
||||||
|
|
||||||
class SearchRoster(View):
|
class SearchObjects(View):
|
||||||
def run_search(self, request, search, _filter, page=1):
|
def run_search(self, request, search, _filter, page=1):
|
||||||
site_conf = get_site_conf()
|
site_conf = get_site_conf()
|
||||||
if _filter is None:
|
if _filter is None:
|
||||||
@@ -215,11 +215,12 @@ class SearchRoster(View):
|
|||||||
return self.get(request, search, page)
|
return self.get(request, search, page)
|
||||||
|
|
||||||
|
|
||||||
class GetRosterFiltered(View):
|
class GetObjectsFiltered(View):
|
||||||
def run_filter(self, request, search, _filter, page=1):
|
def run_filter(self, request, search, _filter, page=1):
|
||||||
site_conf = get_site_conf()
|
site_conf = get_site_conf()
|
||||||
|
|
||||||
if _filter == "type":
|
if _filter == "type":
|
||||||
title = RollingStockType.objects.get(slug__iexact=search)
|
title = get_object_or_404(RollingStockType, slug__iexact=search)
|
||||||
query = Q(rolling_class__type__slug__iexact=search)
|
query = Q(rolling_class__type__slug__iexact=search)
|
||||||
elif _filter == "company":
|
elif _filter == "company":
|
||||||
title = get_object_or_404(Company, slug__iexact=search)
|
title = get_object_or_404(Company, slug__iexact=search)
|
||||||
|
Reference in New Issue
Block a user