Skip to content

Commit

Permalink
fix more code style issues & issues by AI feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerJack239 committed Nov 29, 2024
1 parent 4d94db5 commit 4566e94
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cinema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Movie(models.Model):
description = models.TextField()
duration = models.IntegerField()
genres = models.ManyToManyField("Genre", related_name="movies")
actors = models.ManyToManyField("Actor", related_name="actors")
actors = models.ManyToManyField("Actor", related_name="movie_actors")

def __str__(self):
return f"{self.title} {self.actors.count()} actors"
Expand All @@ -16,7 +16,7 @@ class Genre(models.Model):
name = models.CharField(max_length=50, unique=True)

def __str__(self):
return {self.name}
return self.name


class CinemaHall(models.Model):
Expand Down
4 changes: 2 additions & 2 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def update(self, instance, validated_data):
"name",
instance.name)

instance.row = validated_data.get(
instance.rows = validated_data.get(
"row",
instance.row)
instance.rows)

instance.seats_in_row = validated_data.get(
"seats_in_row",
Expand Down
2 changes: 1 addition & 1 deletion cinema/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
path("genres/<int:pk>/",
GenreDetail.as_view(),
name="genre-detail"),
path("cinema-hall",
path("cinema-hall/",
cinema_hall_list,
name="cinema_hall_list"),
path("cinema-hall/<int:pk>/",
Expand Down
2 changes: 1 addition & 1 deletion cinema/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def patch(self, request, pk):
if serializer.is_valid():
serializer.save()
return Response(status=status.HTTP_200_OK)
return Response(status=status.HTTP_400_BAD_REQUEST)
return Response(serializer.data, status=status.HTTP_400_BAD_REQUEST)

def delete(self, request, pk):
genre = self.get_object(pk)
Expand Down
20 changes: 12 additions & 8 deletions cinema_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,24 @@

AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation."
"UserAttributeSimilarityValidator",
"NAME":
"django.contrib.auth.password_validation."
"UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation."
"MinimumLengthValidator",
"NAME":
"django.contrib.auth.password_validation."
"MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation."
"CommonPasswordValidator",
"NAME":
"django.contrib.auth.password_validation."
"CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation."
"NumericPasswordValidator",
"NAME":
"django.contrib.auth.password_validation."
"NumericPasswordValidator",
},
]

Expand Down

0 comments on commit 4566e94

Please sign in to comment.