feat [both]: save facebook event link
This commit is contained in:
parent
64fbfe376b
commit
3669ddacb3
|
@ -106,6 +106,13 @@
|
|||
</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">
|
||||
<label class="label">Lien de la bannière</label>
|
||||
<div class="control">
|
||||
|
|
|
@ -59,12 +59,18 @@
|
|||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<ButtonIcon
|
||||
<a
|
||||
v-if="film.facebookEventLink"
|
||||
:href="film.facebookEventLink"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<ButtonIcon
|
||||
label="Événement Facebook"
|
||||
icon="ri-facebook-box-fill"
|
||||
class="is-outlined is-primary"
|
||||
/>
|
||||
</a>
|
||||
<ButtonIcon
|
||||
v-if="film.icsDownload"
|
||||
label="Ajouter au calendrier"
|
||||
|
|
|
@ -17,6 +17,7 @@ export type Film = {
|
|||
synopsis?: string
|
||||
originCountry?: string
|
||||
releaseYear?: number
|
||||
facebookEventLink?: string
|
||||
trailerLink?: string
|
||||
isInColor?: boolean
|
||||
movieFormat?: Format
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{{ film.projectionDate || "À planifier" }} - {{ film.title }}
|
||||
<span class="has-text-grey-lighter">#{{ film.id }}</span>
|
||||
</h1>
|
||||
<nuxt-link :to="`${id}/edition`" class="button">
|
||||
<nuxt-link :to="`/admin/${id}/edition`" class="button">
|
||||
<span>Éditer</span>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<h1 class="title">Liste des séances</h1>
|
||||
<ul class="list has-visible-pointer-controls">
|
||||
<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 }}
|
||||
<template v-if="film.director"> de {{ film.director }}</template>
|
||||
</nuxt-link>
|
||||
<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>
|
||||
</nuxt-link>
|
||||
</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)
|
||||
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
|
||||
)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue