-
Notifications
You must be signed in to change notification settings - Fork 70
API App #141
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
base: revampv2
Are you sure you want to change the base?
API App #141
Conversation
…s to filter response
api/views.py
Outdated
| if params.get('status', None): | ||
| try: | ||
| queryset = queryset.filter(status=params.get('status')) | ||
| except: |
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 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()) |
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 don't need to do any parse here. If the date is not proper the filter will return empty.
techievivek
left a comment
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.
We will need the instructor username so please update this.
|
|
||
| class WorkshopSerializer(serializers.ModelSerializer): | ||
| workshop_type = WorkshopTypeField(read_only=True) | ||
|
|
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.
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.
Added API app