Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sepid-org/Manage-Content-Service in…
Browse files Browse the repository at this point in the history
…to test-ci
  • Loading branch information
AmooHashem committed May 8, 2024
2 parents 954dda2 + 91c49b3 commit 63c7ff0
Show file tree
Hide file tree
Showing 39 changed files with 588 additions and 130 deletions.
7 changes: 2 additions & 5 deletions apps/accounts/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from errors.error_codes import serialize_error
from manage_content_service.settings.base import DISCOUNT_CODE_LENGTH
from proxies.sms_system.main import SMS_CODE_LENGTH, SMSServiceProxy
from proxies.sms_system.main import SMS_CODE_LENGTH
from .models import User, VerificationCode, EducationalInstitute, School, University, SchoolStudentship, Studentship, \
AcademicStudentship, Merchandise, DiscountCode, Purchase
from .validators import phone_number_validator, grade_validator, price_validator
Expand Down Expand Up @@ -119,11 +119,8 @@ class Meta:


class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
phone_number = serializers.CharField(
max_length=15, required=False, validators=[phone_number_validator])
password = serializers.CharField(write_only=True, required=True)
username = serializers.CharField(required=False)
email = serializers.EmailField(required=False)
username = serializers.CharField(required=True)

@classmethod
def get_token(cls, user):
Expand Down
Empty file added apps/file_storage/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions apps/file_storage/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions apps/file_storage/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class FileStorageConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.file_storage'
22 changes: 22 additions & 0 deletions apps/file_storage/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.1.3 on 2024-04-18 17:31

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='File',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('file', models.FileField(upload_to='files/')),
],
),
]
Empty file.
11 changes: 11 additions & 0 deletions apps/file_storage/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import uuid
from django.db import models


class File(models.Model):
id = models.UUIDField(primary_key=True, unique=True,
default=uuid.uuid4, editable=False)
file = models.FileField(upload_to='files/')

def __str__(self) -> str:
return {self.name}
11 changes: 11 additions & 0 deletions apps/file_storage/serializers/file_serializer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from rest_framework import serializers

from apps.file_storage.models import File


class FileSerializer(serializers.ModelSerializer):

class Meta:
model = File
fields = ['id', 'file']
read_only_fields = ['id']
11 changes: 11 additions & 0 deletions apps/file_storage/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from rest_framework.routers import DefaultRouter

from .views import FileViewSet

router = DefaultRouter()

router.register(r'file', FileViewSet, basename='file')

urlpatterns = []

urlpatterns += router.urls
15 changes: 15 additions & 0 deletions apps/file_storage/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

from rest_framework.permissions import AllowAny
from rest_framework import viewsets
from rest_framework.parsers import MultiPartParser

from apps.file_storage.models import File
from apps.file_storage.serializers.file_serializer import FileSerializer


class FileViewSet(viewsets.ModelViewSet):
serializer_class = FileSerializer
parser_classes = [MultiPartParser]
queryset = File.objects.all()
my_tags = ['file-storage']
permission_classes = [AllowAny]
2 changes: 1 addition & 1 deletion apps/fsm/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@admin.register(ProgramContactInfo)
class ProgramContactInfoCustomAdmin(admin.ModelAdmin):
list_display = ['id', 'name']
list_display = ['id']
list_filter = []


Expand Down
11 changes: 11 additions & 0 deletions apps/fsm/management/commands/convert_program_cover_page_to_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.core.management.base import BaseCommand
from apps.fsm.models import Event


class Command(BaseCommand):

def handle(self, *args, **options):
for program in Event.objects.all():
if program.cover_page:
program.cover_page2 = program.cover_page.url
program.save()
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0098_fsm_cover_page2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-18 20:08

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0097_rename_game_iframe_alter_widget_widget_type'),
]

operations = [
migrations.AddField(
model_name='fsm',
name='cover_page2',
field=models.URLField(blank=True, null=True),
),
]
17 changes: 17 additions & 0 deletions apps/fsm/migrations/0099_remove_fsm_cover_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.3 on 2024-04-18 20:54

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('fsm', '0098_fsm_cover_page2'),
]

operations = [
migrations.RemoveField(
model_name='fsm',
name='cover_page',
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0100_rename_cover_page2_fsm_cover_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-18 20:54

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('fsm', '0099_remove_fsm_cover_page'),
]

operations = [
migrations.RenameField(
model_name='fsm',
old_name='cover_page2',
new_name='cover_page',
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0101_alter_fsm_cover_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-18 21:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0100_rename_cover_page2_fsm_cover_page'),
]

operations = [
migrations.AlterField(
model_name='fsm',
name='cover_page',
field=models.URLField(default=''),
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0102_alter_fsm_cover_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-18 21:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0101_alter_fsm_cover_page'),
]

operations = [
migrations.AlterField(
model_name='fsm',
name='cover_page',
field=models.URLField(),
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0103_fsm_is_visible.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-18 22:45

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0102_alter_fsm_cover_page'),
]

operations = [
migrations.AddField(
model_name='fsm',
name='is_visible',
field=models.BooleanField(default=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 4.1.3 on 2024-04-21 13:50

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0103_fsm_is_visible'),
]

operations = [
migrations.RemoveField(
model_name='article',
name='party',
),
migrations.RemoveField(
model_name='event',
name='party',
),
migrations.RemoveField(
model_name='fsm',
name='party',
),
migrations.AddField(
model_name='article',
name='website',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='event',
name='website',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='fsm',
name='website',
field=models.CharField(blank=True, max_length=50, null=True),
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0105_event_cover_page2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-28 18:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0104_remove_article_party_remove_event_party_and_more'),
]

operations = [
migrations.AddField(
model_name='event',
name='cover_page2',
field=models.URLField(blank=True, null=True),
),
]
17 changes: 17 additions & 0 deletions apps/fsm/migrations/0106_remove_event_cover_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.3 on 2024-04-28 18:27

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('fsm', '0105_event_cover_page2'),
]

operations = [
migrations.RemoveField(
model_name='event',
name='cover_page',
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0107_rename_cover_page2_event_cover_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-28 18:27

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('fsm', '0106_remove_event_cover_page'),
]

operations = [
migrations.RenameField(
model_name='event',
old_name='cover_page2',
new_name='cover_page',
),
]
18 changes: 18 additions & 0 deletions apps/fsm/migrations/0108_event_is_visible.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2024-04-29 14:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fsm', '0107_rename_cover_page2_event_cover_page'),
]

operations = [
migrations.AddField(
model_name='event',
name='is_visible',
field=models.BooleanField(default=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.1.3 on 2024-04-29 17:47

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('fsm', '0108_event_is_visible'),
]

operations = [
migrations.RemoveField(
model_name='programcontactinfo',
name='name',
),
migrations.AlterField(
model_name='event',
name='program_contact_info',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='program', to='fsm.programcontactinfo'),
),
]
Loading

0 comments on commit 63c7ff0

Please sign in to comment.