Skip to content

Commit

Permalink
fix endpoints & flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
olenazaritska committed Sep 21, 2024
1 parent d2b019a commit f8829c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 12 additions & 3 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ def create(self, validated_data):
return Actor.objects.create(**validated_data)

def update(self, instance, validated_data):
instance.first_name = validated_data.get("first_name", instance.first_name)
instance.last_name = validated_data.get("last_name", instance.last_name)
instance.first_name = validated_data.get(
"first_name",
instance.first_name
)
instance.last_name = validated_data.get(
"last_name",
instance.last_name
)
instance.save()
return instance

Expand All @@ -68,6 +74,9 @@ def create(self, validated_data):
def update(self, instance, validated_data):
instance.name = validated_data.get("name", instance.name)
instance.rows = validated_data.get("rows", instance.rows)
instance.seats_in_row = validated_data.get("seats_in_row", instance.seats_in_row)
instance.seats_in_row = validated_data.get(
"seats_in_row",
instance.seats_in_row
)
instance.save()
return instance
8 changes: 6 additions & 2 deletions cinema/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
path("genres/<int:pk>/", GenreDetail.as_view(), name="genre-detail"),
path("actors/", ActorList.as_view(), name="actor-list"),
path("actors/<int:pk>/", ActorDetail.as_view(), name="actor-detail"),
path("cinema-halls/", cinema_hall_list, name="cinema-hall-list"),
path("cinema-halls/<int:pk>/", cinema_hall_detail, name="cinema-hall-detail"),
path("cinema_halls/", cinema_hall_list, name="cinema-hall-list"),
path(
"cinema_halls/<int:pk>/",
cinema_hall_detail,
name="cinema-hall-detail"
),
path("", include(router.urls)),
]

Expand Down

0 comments on commit f8829c5

Please sign in to comment.