feat [both]: save facebook event link
This commit is contained in:
parent
64fbfe376b
commit
3669ddacb3
8 changed files with 58 additions and 8 deletions
|
@ -106,6 +106,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Lien de l'événement Facebook</label>
|
||||||
|
<div class="control">
|
||||||
|
<input v-model="film.facebookEventLink" class="input" type="url" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Lien de la bannière</label>
|
<label class="label">Lien de la bannière</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
|
|
|
@ -59,12 +59,18 @@
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<ButtonIcon
|
<a
|
||||||
v-if="film.facebookEventLink"
|
v-if="film.facebookEventLink"
|
||||||
|
:href="film.facebookEventLink"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<ButtonIcon
|
||||||
label="Événement Facebook"
|
label="Événement Facebook"
|
||||||
icon="ri-facebook-box-fill"
|
icon="ri-facebook-box-fill"
|
||||||
class="is-outlined is-primary"
|
class="is-outlined is-primary"
|
||||||
/>
|
/>
|
||||||
|
</a>
|
||||||
<ButtonIcon
|
<ButtonIcon
|
||||||
v-if="film.icsDownload"
|
v-if="film.icsDownload"
|
||||||
label="Ajouter au calendrier"
|
label="Ajouter au calendrier"
|
||||||
|
|
|
@ -17,6 +17,7 @@ export type Film = {
|
||||||
synopsis?: string
|
synopsis?: string
|
||||||
originCountry?: string
|
originCountry?: string
|
||||||
releaseYear?: number
|
releaseYear?: number
|
||||||
|
facebookEventLink?: string
|
||||||
trailerLink?: string
|
trailerLink?: string
|
||||||
isInColor?: boolean
|
isInColor?: boolean
|
||||||
movieFormat?: Format
|
movieFormat?: Format
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{ film.projectionDate || "À planifier" }} - {{ film.title }}
|
{{ film.projectionDate || "À planifier" }} - {{ film.title }}
|
||||||
<span class="has-text-grey-lighter">#{{ film.id }}</span>
|
<span class="has-text-grey-lighter">#{{ film.id }}</span>
|
||||||
</h1>
|
</h1>
|
||||||
<nuxt-link :to="`${id}/edition`" class="button">
|
<nuxt-link :to="`/admin/${id}/edition`" class="button">
|
||||||
<span>Éditer</span>
|
<span>Éditer</span>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
<h1 class="title">Liste des séances</h1>
|
<h1 class="title">Liste des séances</h1>
|
||||||
<ul class="list has-visible-pointer-controls">
|
<ul class="list has-visible-pointer-controls">
|
||||||
<li v-for="film of films" :key="film.id" class="list-item">
|
<li v-for="film of films" :key="film.id" class="list-item">
|
||||||
<nuxt-link :to="`admin/${film.id}`" class="list-item-content">
|
<nuxt-link :to="`/admin/${film.id}`" class="list-item-content">
|
||||||
{{ film.projectionDate || "À planifier" }} - {{ film.title }}
|
{{ film.projectionDate || "À planifier" }} - {{ film.title }}
|
||||||
<template v-if="film.director"> de {{ film.director }}</template>
|
<template v-if="film.director"> de {{ film.director }}</template>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
<div class="list-item-controls">
|
<div class="list-item-controls">
|
||||||
<nuxt-link :to="`admin/${film.id}/edition`" class="button">
|
<nuxt-link :to="`/admin/${film.id}/edition`" class="button">
|
||||||
<span>Éditer</span>
|
<span>Éditer</span>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
18
server/myapi/migrations/0005_film_facebook_event_link.py
Normal file
18
server/myapi/migrations/0005_film_facebook_event_link.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -35,6 +35,14 @@ class Film(models.Model):
|
||||||
is_confirmed = models.BooleanField(default=False)
|
is_confirmed = models.BooleanField(default=False)
|
||||||
imdb_id = models.CharField(max_length=10, null=True, blank=True)
|
imdb_id = models.CharField(max_length=10, null=True, blank=True)
|
||||||
tmdb_id = models.IntegerField(null=True, blank=True)
|
tmdb_id = models.IntegerField(null=True, blank=True)
|
||||||
|
facebook_event_link = models.URLField(null=True, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.title} de {self.director} ({self.projection_date.strftime("%d/%m/%Y")})'
|
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
|
||||||
|
)
|
||||||
|
|
|
@ -2,6 +2,16 @@ from rest_framework import serializers
|
||||||
from .models import Film
|
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 FilmSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in a new issue