mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 06:49:37 +02:00
client sorting
This commit is contained in:
parent
f5fc2f5add
commit
586ea89785
2 changed files with 7 additions and 7 deletions
|
@ -90,8 +90,8 @@ class AdventureViewSet(viewsets.ModelViewSet):
|
||||||
if not request.user.is_authenticated:
|
if not request.user.is_authenticated:
|
||||||
return Response({"error": "User is not authenticated"}, status=400)
|
return Response({"error": "User is not authenticated"}, status=400)
|
||||||
queryset = Adventure.objects.filter(user_id=request.user.id).exclude(type='featured')
|
queryset = Adventure.objects.filter(user_id=request.user.id).exclude(type='featured')
|
||||||
queryset = self.apply_sorting(queryset)
|
serializer = self.get_serializer(queryset, many=True)
|
||||||
return self.paginate_and_respond(queryset, request)
|
return Response(serializer.data)
|
||||||
|
|
||||||
def paginate_and_respond(self, queryset, request):
|
def paginate_and_respond(self, queryset, request):
|
||||||
paginator = self.pagination_class()
|
paginator = self.pagination_class()
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
previous = result.data.previous;
|
previous = result.data.previous;
|
||||||
count = result.data.count;
|
count = result.data.count;
|
||||||
totalPages = Math.ceil(count / resultsPerPage);
|
totalPages = Math.ceil(count / resultsPerPage);
|
||||||
|
currentPage = 1;
|
||||||
|
|
||||||
console.log(next);
|
console.log(next);
|
||||||
}
|
}
|
||||||
|
@ -248,11 +249,9 @@
|
||||||
class="checkbox checkbox-primary"
|
class="checkbox checkbox-primary"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<!-- <div class="divider"></div> -->
|
||||||
<button type="submit" class="btn btn-primary mt-4">Filter</button>
|
|
||||||
<div class="divider"></div>
|
|
||||||
<h3 class="text-center font-semibold text-lg mb-4">Sort</h3>
|
<h3 class="text-center font-semibold text-lg mb-4">Sort</h3>
|
||||||
<p>Order Direction</p>
|
<p class="text-md font-semibold mb-2">Order Direction</p>
|
||||||
<label for="asc">Ascending</label>
|
<label for="asc">Ascending</label>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
|
@ -271,7 +270,7 @@
|
||||||
class="radio radio-primary"
|
class="radio radio-primary"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<p>Order By</p>
|
<p class="text-md font-semibold mt-2 mb-2">Order By</p>
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
|
@ -291,6 +290,7 @@
|
||||||
id="rating"
|
id="rating"
|
||||||
class="radio radio-primary"
|
class="radio radio-primary"
|
||||||
/>
|
/>
|
||||||
|
<button type="submit" class="btn btn-primary mt-4">Filter</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<h3 class="text-center font-semibold text-lg mb-4">View</h3>
|
<h3 class="text-center font-semibold text-lg mb-4">View</h3>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue