Skip to content

Conversation

@pnshiralkar
Copy link
Contributor

Added API app

@ankitjavalkar ankitjavalkar marked this pull request as draft May 21, 2020 08:23
api/views.py Outdated
if params.get('status', None):
try:
queryset = queryset.filter(status=params.get('status'))
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the try-except anywhere if filter query is not successful it won't throw any error

api/views.py Outdated
pass
if params.get('date_from'):
try:
queryset = queryset.filter(date__gte=dateutil.parser.parse(params.get('date_from')).date())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to do any parse here. If the date is not proper the filter will return empty.

Copy link

@techievivek techievivek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need the instructor username so please update this.


class WorkshopSerializer(serializers.ModelSerializer):
workshop_type = WorkshopTypeField(read_only=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the instructor name, not the id so, please add this line of code here

instructor=serializers.StringRelatedField(many=False)

I have tested it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants