diff --git a/backend/.gitignore b/backend/.gitignore index 40f5085..69efed3 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -144,4 +144,7 @@ GitHub.sublime-settings **/migrations/** !**/migrations !**/migrations/__init__.py -videoflix/users/migrations \ No newline at end of file +videoflix/users/migrations + +# Statics +videoflix/staticfiles \ No newline at end of file diff --git a/backend/videoflix/content/admin.py b/backend/videoflix/content/admin.py index b7e2741..63b258b 100644 --- a/backend/videoflix/content/admin.py +++ b/backend/videoflix/content/admin.py @@ -1,4 +1,12 @@ from django.contrib import admin from .models import Video +from import_export import resources +from import_export.admin import ImportExportModelAdmin -admin.site.register(Video) \ No newline at end of file +class VideoResource(resources.ModelResource): + class Meta: + model = Video + +@admin.register(Video) +class VideoAdmin(ImportExportModelAdmin): + pass \ No newline at end of file diff --git a/backend/videoflix/content/class_assets.py b/backend/videoflix/content/class_assets.py new file mode 100644 index 0000000..2d707cc --- /dev/null +++ b/backend/videoflix/content/class_assets.py @@ -0,0 +1,18 @@ +FILM_GENRES = [ + ('action', 'Action'), + ('adventure', 'Adventure'), + ('comedy', 'Comedy'), + ('drama', 'Drama'), + ('horror', 'Horror'), + ('science_fiction', 'Science Fiction'), + ('fantasy', 'Fantasy'), + ('romance', 'Romance'), + ('thriller', 'Thriller'), + ('mystery', 'Mystery'), + ('crime', 'Crime'), + ('animation', 'Animation'), + ('documentary', 'Documentary'), + ('musical', 'Musical'), + ('war', 'War'), + ('western', 'Western'), +] diff --git a/backend/videoflix/content/models.py b/backend/videoflix/content/models.py index 03d51da..101f155 100644 --- a/backend/videoflix/content/models.py +++ b/backend/videoflix/content/models.py @@ -1,11 +1,12 @@ from django.db import models from datetime import date +from .class_assets import FILM_GENRES class Video(models.Model): created_at = models.DateField(default=date.today) title = models.CharField(max_length=80) description = models.CharField(max_length=500) - film_genre = models.CharField(max_length=50, blank=True, null=True) + film_genre = models.CharField(max_length=20, choices=FILM_GENRES, blank=True, null=True) video_file = models.FileField(upload_to='videos/', blank=True, null=True) thumbnail = models.ImageField(upload_to='thumbnails/', blank=True, null=True) diff --git a/backend/videoflix/videoflix/settings.py b/backend/videoflix/videoflix/settings.py index b409e61..422895c 100644 --- a/backend/videoflix/videoflix/settings.py +++ b/backend/videoflix/videoflix/settings.py @@ -53,6 +53,7 @@ INSTALLED_APPS = [ 'corsheaders', 'debug_toolbar', 'django_rq', + 'import_export', 'content.apps.ContentConfig', 'users', ] @@ -121,6 +122,11 @@ MEDIA_URL = '/media/' WSGI_APPLICATION = 'videoflix.wsgi.application' +# Statics + +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') +IMPORT_EXPORT_USE_TRANSACTIONS = True + # Database # https://docs.djangoproject.com/en/5.0/ref/settings/#databases diff --git a/frontend/src/app/components/home/browse/categories/categories.component.ts b/frontend/src/app/components/home/browse/categories/categories.component.ts index 0f02157..8a7b139 100644 --- a/frontend/src/app/components/home/browse/categories/categories.component.ts +++ b/frontend/src/app/components/home/browse/categories/categories.component.ts @@ -17,22 +17,22 @@ export class CategoriesComponent { environmentBaseUrl: string = environment.baseUrl.slice(0, -1); filmGenres = [ - 'Action', - 'Adventure', - 'Comedy', - 'Drama', - 'Horror', - 'Science Fiction', - 'Fantasy', - 'Romance', - 'Thriller', - 'Mystery', - 'Crime', - 'Animation', - 'Documentary', - 'Musical', - 'War', - 'Western', + 'action', + 'adventure', + 'comedy', + 'drama', + 'horror', + 'science_fiction', + 'fantasy', + 'romance', + 'thriller', + 'mystery', + 'crime', + 'animation', + 'documentary', + 'musical', + 'war', + 'western', ]; openCurrentMovie(movieId: number) { diff --git a/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.html b/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.html index a921a64..5a45a2b 100644 --- a/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.html +++ b/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.html @@ -4,7 +4,7 @@ 'background-image': 'url(' + environmentBaseUrl + - currentMovie[0]?.thumbnail.replace('.jpg', '_1920p.jpg') + + currentMovie[0]?.thumbnail.replace('.jpg', '_1080p.jpg') + ')' }" >