Skip to content

Commit

Permalink
Added logo model
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamín Mravec committed Nov 11, 2023
1 parent df80b0a commit 043f0bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
5 changes: 0 additions & 5 deletions cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ class Meta:
upload_to='logo_images/',
verbose_name='Logo', null=True, blank=True)

def __str__(self):
return f'{self.series.semester.competition.name}-{self.series.semester.year}' \
f'-{self.series.semester.season[0]}S-S{self.series.order} - {self.order}. úloha'



class InfoBanner(ModelWithVisibility):
class Meta:
Expand Down
14 changes: 4 additions & 10 deletions cms/views.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
from rest_framework import viewsets
from rest_framework import viewsets, exceptions, status
from rest_framework.decorators import action
from rest_framework.response import Response

from cms.models import InfoBanner, MenuItem, MessageTemplate, Post, Logo
from cms.permissions import PostPermission
from cms.permissions import PostPermission, IsAdminUser
from cms.serializers import (InfoBannerSerializer, MenuItemShortSerializer,
MessageTemplateSerializer, PostSerializer, LogoSerializer)


from django.http import HttpResponse
from rest_framework import exceptions, status, viewsets
from rest_framework.decorators import action
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from rest_framework.response import Response

from base.utils import mime_type

class MenuItemViewSet(viewsets.ReadOnlyModelViewSet):
Expand Down Expand Up @@ -51,7 +45,7 @@ def visible(self, request):
posts = self.filter_queryset(self.get_queryset()).visible()
serializer = PostSerializer(posts, many=True)
return Response(serializer.data)


class LogoViewSet(viewsets.ModelViewSet):
"""Publikácie(výsledky, brožúrky, časopisy, ...)"""
Expand All @@ -72,7 +66,7 @@ def perform_create(self, serializer):
'Nedostatočné práva na vytvorenie tohoto objektu')

@action(methods=['get'], detail=True, url_path='download')
def download_logo(self, request, pk=None):
def download_logo(self, request):
"""Stiahne logo"""
logo = self.get_object()
response = HttpResponse(
Expand Down

0 comments on commit 043f0bc

Please sign in to comment.