Skip to content

Commit

Permalink
feat: download
Browse files Browse the repository at this point in the history
  • Loading branch information
Shavkatjon-O committed Sep 15, 2024
1 parent 7b8883d commit 5d57678
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions apps/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ class MobileDownload(BaseModel):
class DesktopDownloadSerializer(serializers.ModelSerializer):
class Meta:
model = DesktopDownload
fields = "__all__"
fields = ["file"]


class MobileDownloadSerializer(serializers.ModelSerializer):
class Meta:
model = MobileDownload
fields = "__all__"
fields = ["file"]


class DesktopDownloadDetailView(generics.RetrieveAPIView):
queryset = DesktopDownload.objects.all().first()
class DesktopDownloadDetailView(generics.ListAPIView):
queryset = DesktopDownload.objects.all().order_by("-created_at")[:1]
serializer_class = DesktopDownloadSerializer
permission_classes = [AllowAny]


class MobileDownloadDetailView(generics.RetrieveAPIView):
queryset = MobileDownload.objects.all().first()
class MobileDownloadDetailView(generics.ListAPIView):
queryset = MobileDownload.objects.all().order_by("-created_at")[:1]
serializer_class = MobileDownloadSerializer
permission_classes = [AllowAny]
10 changes: 8 additions & 2 deletions apps/common/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
from .models import DesktopDownloadDetailView, MobileDownloadDetailView

urlpatterns = [
path("desktop/", DesktopDownloadDetailView.as_view(), name="desktop-download"),
path("mobile/", MobileDownloadDetailView.as_view(), name="mobile-download"),
path(
"downloads/desktop/",
DesktopDownloadDetailView.as_view(),
name="desktop-download",
),
path(
"downloads/mobile/", MobileDownloadDetailView.as_view(), name="mobile-download"
),
]

0 comments on commit 5d57678

Please sign in to comment.