mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-03-23 09:51:21 +01:00
add tests and fix missing get_queryset
This commit is contained in:
committed by
icovada
parent
3b2b6d6473
commit
49cac0588e
@@ -6,7 +6,7 @@ from apps.api.serializers import DCAStrategySerializer, DCAEntrySerializer
|
||||
|
||||
|
||||
class DCAStrategyViewSet(viewsets.ModelViewSet):
|
||||
queryset = DCAStrategy.all_objects.all()
|
||||
queryset = DCAStrategy.objects.all()
|
||||
serializer_class = DCAStrategySerializer
|
||||
filterset_fields = {
|
||||
"name": ["exact", "icontains"],
|
||||
@@ -22,9 +22,6 @@ class DCAStrategyViewSet(viewsets.ModelViewSet):
|
||||
def get_queryset(self):
|
||||
return DCAStrategy.objects.all()
|
||||
|
||||
def get_queryset(self):
|
||||
return DCAStrategy.objects.all().order_by("id")
|
||||
|
||||
@action(detail=True, methods=["get"])
|
||||
def investment_frequency(self, request, pk=None):
|
||||
strategy = self.get_object()
|
||||
@@ -59,6 +56,11 @@ class DCAEntryViewSet(viewsets.ModelViewSet):
|
||||
"created_at": ["exact", "gte", "lte", "gt", "lt"],
|
||||
"updated_at": ["exact", "gte", "lte", "gt", "lt"],
|
||||
}
|
||||
search_fields = ['notes']
|
||||
ordering_fields = '__all__'
|
||||
ordering = ['-date']
|
||||
search_fields = ["notes"]
|
||||
ordering_fields = "__all__"
|
||||
ordering = ["-date"]
|
||||
|
||||
def get_queryset(self):
|
||||
# Filter entries by strategies the user has access to
|
||||
accessible_strategies = DCAStrategy.objects.all()
|
||||
return DCAEntry.objects.filter(strategy__in=accessible_strategies)
|
||||
|
||||
Reference in New Issue
Block a user