Skip to content

Commit

Permalink
Merge pull request #46 from LikeLion-at-DGU/feature/ljb-order
Browse files Browse the repository at this point in the history
πŸš‘οΈ Hotfix : Revert μ½”λ“œ μˆ˜μ • 및 재적용
  • Loading branch information
pump9918 authored May 26, 2024
2 parents 065d7ff + 98a6a4b commit acb54c0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
19 changes: 19 additions & 0 deletions booth/migrations/0008_alter_comment_password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 5.0.4 on 2024-05-27 00:14

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('booth', '0007_alter_boothlocationoperationtime_unique_together'),
]

operations = [
migrations.AlterField(
model_name='comment',
name='password',
field=models.CharField(max_length=4, validators=[django.core.validators.RegexValidator(message='Error : Password must be a 4-digit number', regex='^\\d{4}$')]),
),
]
7 changes: 5 additions & 2 deletions booth/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models
from core.models import *

from django.core.validators import RegexValidator
# Create your models here.

TYPE_CHOICES=(
Expand Down Expand Up @@ -63,7 +63,10 @@ class BoothImage(BaseImage):
class Comment(models.Model):
booth=models.ForeignKey(Booth, on_delete=models.CASCADE, related_name='comments')
content=models.TextField()
password=models.CharField(max_length=10, null=False, blank=False)
password = models.CharField(
max_length=4,
validators=[RegexValidator(regex='^\d{4}$', message='Error : Password must be a 4-digit number')]
)
created_at=models.DateTimeField(auto_now_add=True)

def __str__(self):
Expand Down
7 changes: 6 additions & 1 deletion booth/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime
from rest_framework import serializers
from django.core.validators import RegexValidator

from.models import Booth, BoothImage, BoothLike, Comment, BoothLocationOperationTime
from datetime import datetime, date
Expand Down Expand Up @@ -188,7 +189,11 @@ class Meta:
]

class CommentSerializer(serializers.ModelSerializer):
password = serializers.CharField(write_only=True)
password = serializers.CharField(
max_length=4,
validators=[RegexValidator(regex='^\d{4}$', message='Error : Password must be a 4-digit number')]
, write_only=True)

content = serializers.CharField()

def create(self, validated_data):
Expand Down
2 changes: 1 addition & 1 deletion notice/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# queryset = Notification.objects.all()

class NotificationViewSet(viewsets.GenericViewSet, mixins.ListModelMixin):
queryset = Notification.objects.all()
queryset = Notification.objects.all().order_by('id')

def get_serializer_class(self):
if self.action == 'list':
Expand Down
2 changes: 1 addition & 1 deletion promo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# λ””ν…ŒμΌ νŽ˜μ΄μ§€κ°€ ν•„μš”μΉ˜ μ•ŠμœΌλ―€λ‘œ list만 κ΅¬ν˜„
class PromotionViewSet(viewsets.GenericViewSet, mixins.ListModelMixin):
queryset = Promotion.objects.all()
queryset = Promotion.objects.all().order_by('id')
serializer_class = PromotionSerializer

class PromotionBannerViewSet(viewsets.GenericViewSet, mixins.ListModelMixin):
Expand Down
4 changes: 2 additions & 2 deletions timetable/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ def get_serializer_class(self):
return PerformanceSerializer

class ArtistViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, mixins.RetrieveModelMixin):
queryset = Artist.objects.all()
queryset = Artist.objects.all().order_by('id')
serializer_class = ArtistSerializer
filter_backends = [DjangoFilterBackend]
filterset_class = ArtistFilter

class MusicViewSet(viewsets.GenericViewSet, mixins.ListModelMixin):
queryset = Music.objects.all()
queryset = Music.objects.all().order_by('id')
serializer_class = MusicSerializer

class isNowPerformanceViewSet(viewsets.GenericViewSet, mixins.ListModelMixin):
Expand Down

0 comments on commit acb54c0

Please sign in to comment.