diff --git a/server/proj/audio/models.py b/server/proj/audio/models.py index 7e3f786..46cada6 100644 --- a/server/proj/audio/models.py +++ b/server/proj/audio/models.py @@ -20,9 +20,19 @@ class Song(models.Model): def __str__(self): return f"{self.artist} - {self.title}" + + class Meta: + verbose_name = 'Треки' + verbose_name_plural = 'Треки' + class FavoriteSong(models.Model): song = models.ForeignKey(Song, verbose_name='Трек', on_delete=models.CASCADE, null=True, blank=True) user = models.ForeignKey(MyUser, verbose_name='Пользователь', on_delete=models.CASCADE, blank=True, null=True) def __str__(self): return f"{self.song.title}" + + class Meta: + verbose_name = 'Избранные Треки' + unique_together = ('song', 'user') + verbose_name_plural = 'Избранные Треки' diff --git a/server/proj/conf/__pycache__/urls.cpython-310.pyc b/server/proj/conf/__pycache__/urls.cpython-310.pyc index 94c8ae3..dfd1564 100644 Binary files a/server/proj/conf/__pycache__/urls.cpython-310.pyc and b/server/proj/conf/__pycache__/urls.cpython-310.pyc differ diff --git a/server/proj/conf/__pycache__/wsgi.cpython-310.pyc b/server/proj/conf/__pycache__/wsgi.cpython-310.pyc index 55d1c04..c38fff5 100644 Binary files a/server/proj/conf/__pycache__/wsgi.cpython-310.pyc and b/server/proj/conf/__pycache__/wsgi.cpython-310.pyc differ diff --git a/server/proj/conf/settings/__pycache__/base.cpython-310.pyc b/server/proj/conf/settings/__pycache__/base.cpython-310.pyc index e36e199..4b29152 100644 Binary files a/server/proj/conf/settings/__pycache__/base.cpython-310.pyc and b/server/proj/conf/settings/__pycache__/base.cpython-310.pyc differ diff --git a/server/proj/conf/settings/__pycache__/development.cpython-310.pyc b/server/proj/conf/settings/__pycache__/development.cpython-310.pyc index 5a9aa36..a7b4e8e 100644 Binary files a/server/proj/conf/settings/__pycache__/development.cpython-310.pyc and b/server/proj/conf/settings/__pycache__/development.cpython-310.pyc differ diff --git a/server/proj/conf/settings/development.py b/server/proj/conf/settings/development.py index 9088409..9dc9cf2 100644 --- a/server/proj/conf/settings/development.py +++ b/server/proj/conf/settings/development.py @@ -6,7 +6,7 @@ ALLOWED_HOSTS = ['*'] # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases -DATABASES = { +""" DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'it_radio', @@ -15,6 +15,12 @@ DATABASES = { 'HOST': 'localhost', 'PORT': '5433', }, +} """ +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } } REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] = ('rest_framework.permissions.AllowAny',) diff --git a/server/proj/conf/urls.py b/server/proj/conf/urls.py index 8c4f098..f439fab 100644 --- a/server/proj/conf/urls.py +++ b/server/proj/conf/urls.py @@ -7,7 +7,6 @@ from rest_framework_simplejwt.views import ( TokenVerifyView, ) from django.conf.urls.static import static -from news import views as newsViews from rest_framework import routers from userProfile.views import TeamViewSet from django.conf import settings @@ -17,7 +16,6 @@ from audio.views import SongViewSet router = routers.DefaultRouter() -router.register(r'news', newsViews.NewsViewSet) router.register(r'teams', TeamViewSet, basename='teams') router.register(r'rubriks', RubricViewSet, basename='rubriks') router.register(r'song', SongViewSet, basename='song') diff --git a/server/proj/config_site/admin.py b/server/proj/config_site/admin.py index 184b3ff..e69de29 100644 --- a/server/proj/config_site/admin.py +++ b/server/proj/config_site/admin.py @@ -1,6 +0,0 @@ -from django.contrib import admin -from .models import ConfigSite - -@admin.register(ConfigSite) -class ConfigSiteAdmin(admin.ModelAdmin): - list_display = ('id', 'social_name', 'social_url') \ No newline at end of file diff --git a/server/proj/config_site/models.py b/server/proj/config_site/models.py index 5762fa8..3c78413 100644 --- a/server/proj/config_site/models.py +++ b/server/proj/config_site/models.py @@ -1,12 +1,13 @@ from django.db import models -class ConfigSite(models.Model): - social_name = models.CharField('Название социальной сети', max_length=100) - social_url = models.CharField('Социальная сеть', max_length=100) - - def __str__(self): - return self.social_name +class Page(models.Model): + name = models.CharField('Название страницы', max_length=50) + title_1 = models.TextField('Главный заголовок на странице', null=True, blank=True, max_length=300) + title_2 = models.TextField('Второй заголовок на странице', null=True, blank=True, max_length=300) + title_3 = models.TextField('Третий заголовок на странице', null=True, blank=True, max_length=300) + video = models.FileField('Видео', upload_to='videos/', null=True, blank=True) + img = models.ImageField('Изображение', blank=True, null=True, upload_to="images/") + title_4 = models.TextField('Заголовок "Поддержи нас" ', null=True, blank=True, max_length=200) - class Meta: - verbose_name = 'Настройки сайта' - verbose_name_plural = 'Настройки сайта' + def __str__(self): + return self.name diff --git a/server/proj/config_site/serializer.py b/server/proj/config_site/serializer.py new file mode 100644 index 0000000..e69de29 diff --git a/server/proj/config_site/views.py b/server/proj/config_site/views.py index 91ea44a..10ce4eb 100644 --- a/server/proj/config_site/views.py +++ b/server/proj/config_site/views.py @@ -1,3 +1,11 @@ from django.shortcuts import render +from rest_framework.viewsets import ViewSet, GenericViewSet +from rest_framework.response import Response +from rest_framework.decorators import action +from rest_framework import status +from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned +from django.shortcuts import get_object_or_404, get_list_or_404 +from rest_framework.permissions import IsAuthenticated +import requests +from .models import Page -# Create your views here. diff --git a/server/proj/loginApi/migrations/__pycache__/__init__.cpython-310.pyc b/server/proj/loginApi/migrations/__pycache__/__init__.cpython-310.pyc index f02b88e..6dae44d 100644 Binary files a/server/proj/loginApi/migrations/__pycache__/__init__.cpython-310.pyc and b/server/proj/loginApi/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/server/proj/news/__pycache__/admin.cpython-310.pyc b/server/proj/news/__pycache__/admin.cpython-310.pyc index 04b0f23..b50d265 100644 Binary files a/server/proj/news/__pycache__/admin.cpython-310.pyc and b/server/proj/news/__pycache__/admin.cpython-310.pyc differ diff --git a/server/proj/news/__pycache__/models.cpython-310.pyc b/server/proj/news/__pycache__/models.cpython-310.pyc index d090dbf..8a3968e 100644 Binary files a/server/proj/news/__pycache__/models.cpython-310.pyc and b/server/proj/news/__pycache__/models.cpython-310.pyc differ diff --git a/server/proj/news/__pycache__/views.cpython-310.pyc b/server/proj/news/__pycache__/views.cpython-310.pyc index 6e90107..8a1f821 100644 Binary files a/server/proj/news/__pycache__/views.cpython-310.pyc and b/server/proj/news/__pycache__/views.cpython-310.pyc differ diff --git a/server/proj/news/admin.py b/server/proj/news/admin.py index f550314..e69de29 100644 --- a/server/proj/news/admin.py +++ b/server/proj/news/admin.py @@ -1,8 +0,0 @@ -from django.contrib import admin -from .models import News - -class NewsAdmin(admin.ModelAdmin): - list_display = ('name', 'date') # поля, которые будут отображаться - ordering = ('-date',) # сортировка по дате в обратном порядке - -admin.site.register(News, NewsAdmin) diff --git a/server/proj/news/migrations/__pycache__/0001_initial.cpython-310.pyc b/server/proj/news/migrations/__pycache__/0001_initial.cpython-310.pyc index e4ac190..6e4bf6d 100644 Binary files a/server/proj/news/migrations/__pycache__/0001_initial.cpython-310.pyc and b/server/proj/news/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/server/proj/news/migrations/__pycache__/0002_alter_news_author_alter_news_date.cpython-310.pyc b/server/proj/news/migrations/__pycache__/0002_alter_news_author_alter_news_date.cpython-310.pyc index ee4430e..f925faa 100644 Binary files a/server/proj/news/migrations/__pycache__/0002_alter_news_author_alter_news_date.cpython-310.pyc and b/server/proj/news/migrations/__pycache__/0002_alter_news_author_alter_news_date.cpython-310.pyc differ diff --git a/server/proj/news/migrations/__pycache__/__init__.cpython-310.pyc b/server/proj/news/migrations/__pycache__/__init__.cpython-310.pyc index ea0c075..4f346bb 100644 Binary files a/server/proj/news/migrations/__pycache__/__init__.cpython-310.pyc and b/server/proj/news/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/server/proj/news/models.py b/server/proj/news/models.py index e3a4a8e..26d6844 100644 --- a/server/proj/news/models.py +++ b/server/proj/news/models.py @@ -1,8 +1,8 @@ from django.db import models +from django.utils import timezone - -class News(models.Model): - name = models.CharField(max_length=255) - description = models.TextField() - date = models.DateTimeField(blank=True) - author = models.CharField(max_length=255, blank=True) \ No newline at end of file +class HistoryRadio(models.Model): + description = models.CharField('Описание события кратко', max_length=50) + date = models.DateField('Дата события', default=timezone.now, null=True) + def __str__(self): + return f"{self.date}: {self.description}" diff --git a/server/proj/news/serializers.py b/server/proj/news/serializers.py index c6c2714..e69de29 100644 --- a/server/proj/news/serializers.py +++ b/server/proj/news/serializers.py @@ -1,7 +0,0 @@ -from rest_framework import serializers -from .models import News - -class NewsSerializer(serializers.ModelSerializer): - class Meta: - model = News - fields = ['id', 'name', 'description', 'date', 'author'] \ No newline at end of file diff --git a/server/proj/news/views.py b/server/proj/news/views.py index 39c578d..8e890f4 100644 --- a/server/proj/news/views.py +++ b/server/proj/news/views.py @@ -1,8 +1 @@ -from rest_framework import viewsets -from .models import News - -from news.serializers import NewsSerializer - -class NewsViewSet(viewsets.ModelViewSet): - queryset = News.objects.all() - serializer_class = NewsSerializer \ No newline at end of file +from .models import HistoryRadio diff --git a/server/proj/rubricks/migrations/__pycache__/0001_initial.cpython-310.pyc b/server/proj/rubricks/migrations/__pycache__/0001_initial.cpython-310.pyc index 5ebac39..f35ca27 100644 Binary files a/server/proj/rubricks/migrations/__pycache__/0001_initial.cpython-310.pyc and b/server/proj/rubricks/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/server/proj/rubricks/migrations/__pycache__/0002_alter_rubric_time.cpython-310.pyc b/server/proj/rubricks/migrations/__pycache__/0002_alter_rubric_time.cpython-310.pyc index 64bca3a..3d2a31a 100644 Binary files a/server/proj/rubricks/migrations/__pycache__/0002_alter_rubric_time.cpython-310.pyc and b/server/proj/rubricks/migrations/__pycache__/0002_alter_rubric_time.cpython-310.pyc differ diff --git a/server/proj/rubricks/migrations/__pycache__/0003_remove_rubric_time.cpython-310.pyc b/server/proj/rubricks/migrations/__pycache__/0003_remove_rubric_time.cpython-310.pyc index 7aed6ba..bc0e1e4 100644 Binary files a/server/proj/rubricks/migrations/__pycache__/0003_remove_rubric_time.cpython-310.pyc and b/server/proj/rubricks/migrations/__pycache__/0003_remove_rubric_time.cpython-310.pyc differ diff --git a/server/proj/rubricks/migrations/__pycache__/__init__.cpython-310.pyc b/server/proj/rubricks/migrations/__pycache__/__init__.cpython-310.pyc index 23d6dd7..818ee0c 100644 Binary files a/server/proj/rubricks/migrations/__pycache__/__init__.cpython-310.pyc and b/server/proj/rubricks/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/server/proj/userProfile/__pycache__/serializers.cpython-310.pyc b/server/proj/userProfile/__pycache__/serializers.cpython-310.pyc index 45c6771..5776f84 100644 Binary files a/server/proj/userProfile/__pycache__/serializers.cpython-310.pyc and b/server/proj/userProfile/__pycache__/serializers.cpython-310.pyc differ diff --git a/server/proj/userProfile/__pycache__/views.cpython-310.pyc b/server/proj/userProfile/__pycache__/views.cpython-310.pyc index 054668b..8aee8d4 100644 Binary files a/server/proj/userProfile/__pycache__/views.cpython-310.pyc and b/server/proj/userProfile/__pycache__/views.cpython-310.pyc differ diff --git a/server/proj/userProfile/migrations/__pycache__/0001_initial.cpython-310.pyc b/server/proj/userProfile/migrations/__pycache__/0001_initial.cpython-310.pyc index b2de049..2da3b86 100644 Binary files a/server/proj/userProfile/migrations/__pycache__/0001_initial.cpython-310.pyc and b/server/proj/userProfile/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/server/proj/userProfile/migrations/__pycache__/0002_alter_profile_likedsongs.cpython-310.pyc b/server/proj/userProfile/migrations/__pycache__/0002_alter_profile_likedsongs.cpython-310.pyc index 6df8621..4ba943f 100644 Binary files a/server/proj/userProfile/migrations/__pycache__/0002_alter_profile_likedsongs.cpython-310.pyc and b/server/proj/userProfile/migrations/__pycache__/0002_alter_profile_likedsongs.cpython-310.pyc differ diff --git a/server/proj/userProfile/migrations/__pycache__/__init__.cpython-310.pyc b/server/proj/userProfile/migrations/__pycache__/__init__.cpython-310.pyc index fd1d344..c5de2f2 100644 Binary files a/server/proj/userProfile/migrations/__pycache__/__init__.cpython-310.pyc and b/server/proj/userProfile/migrations/__pycache__/__init__.cpython-310.pyc differ