chore [P-0]: сhore
This commit is contained in:
1 parent
d13d02fadb
commit
2e48e08b83
389 files changed
+17779
-11492
No files matched your search
Regular → Executable
File mode changed.
Regular → Executable
+2
-3
@@ -1,4 +1,3 @@
|
||||
from django.contrib import admin
|
||||
from .models import *
|
||||
# Register your models here.
|
||||
|
||||
@@ -33,5 +32,5 @@ from .models import *
|
||||
# return super().formfield_for_manytomany(
|
||||
# db_field, request, using=self.using, **kwargs
|
||||
# )
|
||||
|
||||
# admin.site.register(Carousels, MultiDBModelAdmin)
|
||||
|
||||
# admin.site.register(Carousels, MultiDBModelAdmin)
|
||||
Regular → Executable
+2
-2
@@ -2,5 +2,5 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class GarbageConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'garbage'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "garbage"
|
||||
Regular → Executable
+4
-5
@@ -8,17 +8,16 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
|
||||
class Carousels(models.Model):
|
||||
title = models.CharField(max_length=255)
|
||||
text = models.TextField(blank=True, null=True)
|
||||
link = models.ImageField(upload_to='fns/%Y/%m/%d', default="newsimage/default.jpg", null=True, verbose_name='Картинка')
|
||||
link = models.ImageField(upload_to="fns/%Y/%m/%d", default="newsimage/default.jpg", null=True, verbose_name="Картинка")
|
||||
order = models.IntegerField(blank=True, null=True)
|
||||
link2 = models.ImageField(upload_to='fns/%Y/%m/%d', null=True, verbose_name='Картинка2')
|
||||
link2 = models.ImageField(upload_to="fns/%Y/%m/%d", null=True, verbose_name="Картинка2")
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'carousels'
|
||||
db_table = "carousels"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.title)
|
||||
Regular → Executable
+4
-6
@@ -1,11 +1,9 @@
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
|
||||
class CarouselsSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
||||
model = Carousels
|
||||
fields = '__all__'
|
||||
class Meta:
|
||||
model = Carousels
|
||||
fields = "__all__"
|
||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
Regular → Executable
+3
-13
@@ -1,17 +1,7 @@
|
||||
from django.urls import include, path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from django.urls import path
|
||||
|
||||
from .views import *
|
||||
|
||||
from rest_framework_simplejwt.views import (
|
||||
TokenObtainPairView,
|
||||
TokenRefreshView,TokenVerifyView
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
|
||||
path('links/', CaorusAPIView.as_view(), name='CaorusAPIView'),
|
||||
|
||||
|
||||
]
|
||||
path("links/", CaorusAPIView.as_view(), name="CaorusAPIView"),
|
||||
]
|
||||
Regular → Executable
+6
-4
@@ -1,11 +1,13 @@
|
||||
from django.shortcuts import render
|
||||
from rest_framework.generics import ListAPIView
|
||||
from .models import *
|
||||
from rest_framework.response import Response
|
||||
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
|
||||
|
||||
class CaorusAPIView(ListAPIView):
|
||||
"""Карусель с произвольным набором картинок"""
|
||||
|
||||
def get(self, request):
|
||||
queryset = Carousels.objects.using('add_base').all().order_by('order')
|
||||
return Response(CarouselsSerializer(queryset, many=True).data)
|
||||
queryset = Carousels.objects.using("add_base").all().order_by("order")
|
||||
return Response(CarouselsSerializer(queryset, many=True).data)
|
||||
Reference in new issue
Block a user