Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PleatherStarfish committed Dec 11, 2024
1 parent 0759c65 commit a918ca3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions backend/components/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from unittest.mock import patch


# Url: api/components/create/
# Frontend: useCreateComponent
class CreateComponentTests(APITestCase):
def setUp(self):
self.user = CustomUser.objects.create_user(
Expand Down
3 changes: 2 additions & 1 deletion backend/components/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get(self, request):
| Q(type__name__icontains=search_query)
).annotate(similarity=Value(0.0, output_field=FloatField()))

components = (trigram_components | ilike_components).distinct()
components = (trigram_components | ilike_components).distinct("id")

# Dynamically apply filters
try:
Expand Down Expand Up @@ -258,6 +258,7 @@ def get_component_dropdowns(request):
return JsonResponse({"error": str(e)}, status=500)


# tests
@login_required
@api_view(["POST"])
def create_component(request):
Expand Down

0 comments on commit a918ca3

Please sign in to comment.