gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
3
core/apps/home/views/__init__.py
Normal file
3
core/apps/home/views/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .frontend import * # noqa
|
||||
from .home import * # noqa
|
||||
from .post import * # noqa
|
||||
32
core/apps/home/views/frontend.py
Normal file
32
core/apps/home/views/frontend.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Admin panel UI view
|
||||
"""
|
||||
|
||||
from rest_framework import status
|
||||
from rest_framework import generics
|
||||
|
||||
from core.http import views
|
||||
from core.http import models
|
||||
from core.http import serializers
|
||||
|
||||
|
||||
class FrontendTranslationView(generics.ListAPIView, views.ApiResponse):
|
||||
queryset = models.FrontendTranslation.objects.all()
|
||||
serializer_class = serializers.FrontendTransactionSerializer
|
||||
|
||||
def get(self, request, **kwargs):
|
||||
serializer = self.get_serializer(self.get_queryset(), many=True)
|
||||
data = {}
|
||||
|
||||
for obj in serializer.data:
|
||||
data[obj["key"]] = obj["value"]
|
||||
return self.success(data=data, status=status.HTTP_200_OK)
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = self.queryset.all()
|
||||
key = self.request.GET.get("key")
|
||||
|
||||
if key:
|
||||
queryset = queryset.filter(key__icontains=key)
|
||||
|
||||
return queryset
|
||||
7
core/apps/home/views/home.py
Normal file
7
core/apps/home/views/home.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django import views
|
||||
from django import shortcuts
|
||||
|
||||
|
||||
class HomeView(views.View):
|
||||
def get(self, request):
|
||||
return shortcuts.render(request, "user/home.html")
|
||||
12
core/apps/home/views/post.py
Normal file
12
core/apps/home/views/post.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from rest_framework import viewsets
|
||||
|
||||
from core.http import models
|
||||
from core.http import serializers
|
||||
|
||||
|
||||
class PostListView(viewsets.ModelViewSet):
|
||||
queryset = models.Post.objects.all()
|
||||
serializer_class = serializers.PostSerializer
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
Reference in New Issue
Block a user