mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-28 01:09:37 +02:00
feat: Filter visits by user in visits_by_country view
This commit is contained in:
parent
70615a6a16
commit
b9c9021627
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ def regions_by_country(request, country_code):
|
||||||
@permission_classes([IsAuthenticated])
|
@permission_classes([IsAuthenticated])
|
||||||
def visits_by_country(request, country_code):
|
def visits_by_country(request, country_code):
|
||||||
country = get_object_or_404(Country, country_code=country_code)
|
country = get_object_or_404(Country, country_code=country_code)
|
||||||
visits = VisitedRegion.objects.filter(region__country=country)
|
visits = VisitedRegion.objects.filter(region__country=country, user_id=request.user.id)
|
||||||
|
|
||||||
serializer = VisitedRegionSerializer(visits, many=True)
|
serializer = VisitedRegionSerializer(visits, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue