-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement py-tickets-orders #665
base: master
Are you sure you want to change the base?
Conversation
cinema/serializers.py
Outdated
order=order, **ticket_data | ||
) for ticket_data in tickets_data | ||
) | ||
return order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In create/update/delete function you don't need to return anything
cinema/serializers.py
Outdated
Ticket( | ||
order=order, **ticket_data | ||
) for ticket_data in tickets_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving this brackets looks weird
cinema/views.py
Outdated
|
||
if actors: | ||
queryset = queryset.filter( | ||
actors__id__in=actors.split(",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems you need to convert it to int
cinema/serializers.py
Outdated
fields = ("id", "order", "row", "seat", "movie_session") | ||
|
||
|
||
class OrderSerializer(serializers.ModelSerializer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double check the requirements - you need to have different Serializers for POST and GET methods.
cinema/views.py
Outdated
return MovieSessionSerializer | ||
|
||
|
||
class OrderSetPagination(PageNumberPagination): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better structure if you put pagination in separate file
queryset = Order.objects.all() | ||
serializer_class = OrderSerializer | ||
pagination_class = OrderSetPagination | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_serializer_class will need to be implemented here after you add another OrderSerializer
db.sqlite3
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove database from remote
|
||
if self.action == "list": | ||
queryset = queryset.prefetch_related( | ||
"tickets__movie_session__movie", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will need to prefetch on detail action as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to learn how to delete unnecessary files from git)
No description provided.