Skip to content

Commit

Permalink
Remove unnecessary print statements, adjust SlugRelatedField usage, a…
Browse files Browse the repository at this point in the history
…nd update debug settings for better clarity, security, and maintainability.
  • Loading branch information
oboliziuk committed Dec 20, 2024
1 parent 2e02370 commit 199abb8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MovieSessionListSerializer(MovieSessionSerializer):
cinema_hall_name = serializers.SlugRelatedField(
source="cinema_hall", slug_field="name", read_only=True
)
cinema_hall_capacity = serializers.SlugRelatedField(
cinema_hall_capacity = serializers.ReadOnlyField(
source="cinema_hall", slug_field="capacity", read_only=True
)

Expand Down
4 changes: 0 additions & 4 deletions cinema/tests/test_cinema_hall_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,9 @@ def test_patch_cinema_hall(self):
self.assertEqual(CinemaHall.objects.get(id=1).name, "Green")

def test_delete_cinema_hall(self):
print("Before DELETE request:", CinemaHall.objects.all())
response = self.client.delete(
"/api/cinema/cinema_halls/1/",
)
print("After DELETE request:", CinemaHall.objects.all()) # Друкуємо всі об'єкти
print("Count of CinemaHall with id=1:",
CinemaHall.objects.filter(id=1).count()) # Друкуємо кількість об'єктів з id=1
db_cinema_halls_id_1 = CinemaHall.objects.filter(id=1)
self.assertEqual(db_cinema_halls_id_1.count(), 0)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
Expand Down
2 changes: 0 additions & 2 deletions cinema_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"rest_framework",
"debug_toolbar",
"cinema",
"user",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"debug_toolbar.middleware.DebugToolbarMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
Expand Down
Binary file added db.sqlite3
Binary file not shown.

0 comments on commit 199abb8

Please sign in to comment.