diff --git a/front/components/admin/form.vue b/front/components/admin/form.vue
index e858c8a..1502ad7 100644
--- a/front/components/admin/form.vue
+++ b/front/components/admin/form.vue
@@ -106,6 +106,13 @@
+
diff --git a/front/components/movieCard/full.vue b/front/components/movieCard/full.vue
index 402ef75..10a75fe 100644
--- a/front/components/movieCard/full.vue
+++ b/front/components/movieCard/full.vue
@@ -59,12 +59,18 @@
/>
-
+ :href="film.facebookEventLink"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+
+
#{{ film.id }}
-
+
Éditer
diff --git a/front/pages/admin/index.vue b/front/pages/admin/index.vue
index ce48b14..45e9d7f 100644
--- a/front/pages/admin/index.vue
+++ b/front/pages/admin/index.vue
@@ -2,12 +2,12 @@
Liste des séances
-
-
+
{{ film.projectionDate || "À planifier" }} - {{ film.title }}
de {{ film.director }}
-
+
Éditer
diff --git a/server/myapi/migrations/0005_film_facebook_event_link.py b/server/myapi/migrations/0005_film_facebook_event_link.py
new file mode 100644
index 0000000..f408bd8
--- /dev/null
+++ b/server/myapi/migrations/0005_film_facebook_event_link.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.0.3 on 2022-07-13 01:56
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('myapi', '0004_film_imdb_id_film_tmdb_id_alter_film_movie_format'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='film',
+ name='facebook_event_link',
+ field=models.URLField(blank=True, null=True),
+ ),
+ ]
diff --git a/server/myapi/models.py b/server/myapi/models.py
index 5041984..e1fb214 100644
--- a/server/myapi/models.py
+++ b/server/myapi/models.py
@@ -35,6 +35,14 @@ class Film(models.Model):
is_confirmed = models.BooleanField(default=False)
imdb_id = models.CharField(max_length=10, null=True, blank=True)
tmdb_id = models.IntegerField(null=True, blank=True)
+ facebook_event_link = models.URLField(null=True, blank=True)
def __str__(self):
return f'{self.title} de {self.director} ({self.projection_date.strftime("%d/%m/%Y")})'
+
+ def is_publishable(self):
+ return (
+ self.title is not None
+ and self.poster_link is not None
+ and self.projection_date is not None
+ )
diff --git a/server/myapi/serializers.py b/server/myapi/serializers.py
index a801493..821d83b 100644
--- a/server/myapi/serializers.py
+++ b/server/myapi/serializers.py
@@ -2,6 +2,16 @@ from rest_framework import serializers
from .models import Film
+class MoreFieldsModelSerializer(serializers.ModelSerializer):
+ def get_field_names(self, declared_fields, info):
+ expanded_fields = super().get_field_names(declared_fields, info)
+
+ if getattr(self.Meta, "extra_fields", None):
+ return expanded_fields + self.Meta.extra_fields
+ else:
+ return expanded_fields
+
+
class FilmSerializer(serializers.ModelSerializer):
class Meta: