updated movie fields and added movies to admin
This commit is contained in:
parent
a58198b5c9
commit
5daa017860
9 changed files with 184 additions and 18 deletions
|
@ -1,3 +1,4 @@
|
|||
from django.utils import timezone
|
||||
from gunicorn.config import User
|
||||
from rest_framework import serializers
|
||||
from movie_manager.models import Movie, MovieList, Schedule, Showing
|
||||
|
@ -32,7 +33,17 @@ class ShowingSerializer(serializers.ModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = Showing
|
||||
fields = ["public", "showtime", "movie", "owner"]
|
||||
fields = ["id", "public", "showtime", "movie", "owner"]
|
||||
|
||||
def to_internal_value(self, data):
|
||||
validated_data = super().to_internal_value(data)
|
||||
|
||||
if "showtime" in validated_data and timezone.is_naive(
|
||||
validated_data["showtime"]
|
||||
):
|
||||
validated_data["showtime"] = timezone.make_aware(validated_data["showtime"])
|
||||
|
||||
return validated_data
|
||||
|
||||
|
||||
class ScheduleSerializer(serializers.ModelSerializer):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue