diff --git a/backend/animanga_project/__pycache__/settings.cpython-311.pyc b/backend/animanga_project/__pycache__/settings.cpython-311.pyc index 320d1b8c..e265bd56 100644 Binary files a/backend/animanga_project/__pycache__/settings.cpython-311.pyc and b/backend/animanga_project/__pycache__/settings.cpython-311.pyc differ diff --git a/backend/animanga_project/__pycache__/urls.cpython-311.pyc b/backend/animanga_project/__pycache__/urls.cpython-311.pyc index 103521aa..6db12d90 100644 Binary files a/backend/animanga_project/__pycache__/urls.cpython-311.pyc and b/backend/animanga_project/__pycache__/urls.cpython-311.pyc differ diff --git a/backend/animanga_project/settings.py b/backend/animanga_project/settings.py index c4e98e94..45ae4241 100644 --- a/backend/animanga_project/settings.py +++ b/backend/animanga_project/settings.py @@ -139,4 +139,8 @@ 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.AllowAny', ] -} \ No newline at end of file +} + + +MEDIA_ROOT = 'images/' +MEDIA_URL= 'images/' \ No newline at end of file diff --git a/backend/animanga_project/urls.py b/backend/animanga_project/urls.py index 2b90087a..5a45067f 100644 --- a/backend/animanga_project/urls.py +++ b/backend/animanga_project/urls.py @@ -17,6 +17,7 @@ from django.contrib import admin from django.urls import path,include + urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('api.urls')), diff --git a/backend/api/__pycache__/models.cpython-311.pyc b/backend/api/__pycache__/models.cpython-311.pyc index cd42172c..a38587ac 100644 Binary files a/backend/api/__pycache__/models.cpython-311.pyc and b/backend/api/__pycache__/models.cpython-311.pyc differ diff --git a/backend/api/__pycache__/serializers.cpython-311.pyc b/backend/api/__pycache__/serializers.cpython-311.pyc index b656c6d6..322267c4 100644 Binary files a/backend/api/__pycache__/serializers.cpython-311.pyc and b/backend/api/__pycache__/serializers.cpython-311.pyc differ diff --git a/backend/api/__pycache__/urls.cpython-311.pyc b/backend/api/__pycache__/urls.cpython-311.pyc index c951cc3c..898547e4 100644 Binary files a/backend/api/__pycache__/urls.cpython-311.pyc and b/backend/api/__pycache__/urls.cpython-311.pyc differ diff --git a/backend/api/__pycache__/views.cpython-311.pyc b/backend/api/__pycache__/views.cpython-311.pyc index 763bd018..6a4ece91 100644 Binary files a/backend/api/__pycache__/views.cpython-311.pyc and b/backend/api/__pycache__/views.cpython-311.pyc differ diff --git a/backend/api/migrations/0002_remove_anime_season_anime_background_image_and_more.py b/backend/api/migrations/0002_remove_anime_season_anime_background_image_and_more.py new file mode 100644 index 00000000..3954aaef --- /dev/null +++ b/backend/api/migrations/0002_remove_anime_season_anime_background_image_and_more.py @@ -0,0 +1,72 @@ +# Generated by Django 4.2.7 on 2023-11-11 19:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='anime', + name='season', + ), + migrations.AddField( + model_name='anime', + name='background_image', + field=models.ImageField(default=None, upload_to=''), + ), + migrations.AddField( + model_name='anime', + name='end_date', + field=models.DateField(default=None), + ), + migrations.AddField( + model_name='anime', + name='episodes', + field=models.IntegerField(default=0), + ), + migrations.AddField( + model_name='anime', + name='genre', + field=models.TextField(default=None), + ), + migrations.AddField( + model_name='anime', + name='image', + field=models.ImageField(default=None, upload_to=''), + ), + migrations.AddField( + model_name='anime', + name='num_of_fav', + field=models.IntegerField(default=None), + ), + migrations.AddField( + model_name='anime', + name='seasons', + field=models.IntegerField(default=None), + ), + migrations.AddField( + model_name='anime', + name='start_date', + field=models.DateField(default=None), + ), + migrations.AddField( + model_name='anime', + name='studio', + field=models.TextField(default=None), + ), + migrations.AddField( + model_name='anime', + name='yt_trailer', + field=models.TextField(default=None), + ), + migrations.AlterField( + model_name='anime', + name='description', + field=models.TextField(default=None), + ), + ] diff --git a/backend/api/migrations/__pycache__/0002_remove_anime_season_anime_background_image_and_more.cpython-311.pyc b/backend/api/migrations/__pycache__/0002_remove_anime_season_anime_background_image_and_more.cpython-311.pyc new file mode 100644 index 00000000..3df45170 Binary files /dev/null and b/backend/api/migrations/__pycache__/0002_remove_anime_season_anime_background_image_and_more.cpython-311.pyc differ diff --git a/backend/api/models.py b/backend/api/models.py index 416c4d9b..200369c7 100644 --- a/backend/api/models.py +++ b/backend/api/models.py @@ -3,8 +3,28 @@ # Create your models here. class Anime(models.Model): title = models.CharField(max_length=250) - season = models.CharField(max_length=250) - description = models.CharField(max_length=100) + genre = models.TextField(default=None) + + seasons = models.IntegerField(default=None) + + start_date = models.DateField(default=None) + end_date = models.DateField(default=None) + + image = models.ImageField(default=None, upload_to='images') + background_image = models.ImageField(default=None, upload_to='images') + + num_of_fav = models.IntegerField(default=None) + + description = models.TextField(default=None) + + studio = models.TextField(default=None) + + episodes = models.IntegerField(default=0) + + yt_trailer = models.TextField(default=None) + + + def __str__(self): return self.title \ No newline at end of file diff --git a/backend/api/serializers.py b/backend/api/serializers.py index 4cc87389..178e9499 100644 --- a/backend/api/serializers.py +++ b/backend/api/serializers.py @@ -4,4 +4,4 @@ class AnimeSerializer(serializers.ModelSerializer): class Meta: model = Anime - fields = ('id', 'title', 'description',) \ No newline at end of file + fields = ('id', 'title','genre', 'seasons','start_date', 'end_date', 'image','background_image','num_of_fav','description', 'studio', 'episodes', 'yt_trailer', ) \ No newline at end of file diff --git a/backend/api/templates/api/show_image.html b/backend/api/templates/api/show_image.html new file mode 100644 index 00000000..1433e881 --- /dev/null +++ b/backend/api/templates/api/show_image.html @@ -0,0 +1,2 @@ +{% load static %} + \ No newline at end of file diff --git a/backend/api/views.py b/backend/api/views.py index 7dee1ba8..ddd2a077 100644 --- a/backend/api/views.py +++ b/backend/api/views.py @@ -6,6 +6,13 @@ from .models import Anime from .serializers import AnimeSerializer + + + + + + + class DetailAnime(generics.RetrieveUpdateDestroyAPIView): queryset = Anime.objects.all() serializer_class = AnimeSerializer @@ -16,3 +23,6 @@ class ListAnime(generics.ListCreateAPIView): queryset = Anime.objects.all() serializer_class = AnimeSerializer + + + diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index 22fc6293..de177103 100644 Binary files a/backend/db.sqlite3 and b/backend/db.sqlite3 differ diff --git a/backend/images/images/download.jpeg b/backend/images/images/download.jpeg new file mode 100644 index 00000000..9a69f2f6 Binary files /dev/null and b/backend/images/images/download.jpeg differ diff --git a/backend/images/images/download_t3tAWrh.jpeg b/backend/images/images/download_t3tAWrh.jpeg new file mode 100644 index 00000000..9a69f2f6 Binary files /dev/null and b/backend/images/images/download_t3tAWrh.jpeg differ diff --git a/backend/requirements.txt b/backend/requirements.txt index 0f4aee3f..07889d1c 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -3,3 +3,4 @@ gunicorn packaging whitenoise djangorestframework +Pillow \ No newline at end of file