-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update view to their respective views.py #5
base: master
Are you sure you want to change the base?
Conversation
e99c982
to
9d8cea8
Compare
.vscode/settings.json
Outdated
@@ -0,0 +1,3 @@ | |||
{ |
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.
Don't commit your local IDE files into code base, add them into git ignore.
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.
Instead of appending views in name of the file add a views directory and place the files in them like:
views/recipe.py
, views/profile.py
etc.
f5e1b12
to
7f1d0c0
Compare
@waheedahmed Please have a look in to it PR is ready for another pass. |
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.
Import only required model/serializer classes instead of whole modules in all files.
from rest_framework.authentication import TokenAuthentication | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
from following_app import models as following_models |
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.
Import only required model classes instead of whole model module. Same in other files as well.
|
||
from following_app import models as following_models | ||
from profiles_app import permissions | ||
from recipe_app import models as recipe_models |
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.
Same here Import only required model classes instead of whole model module. Same for the serializers as well.
serializer.save(user_profile=self.request.user) | ||
|
||
# override method to get user's own recipe data | ||
def get_queryset(self): |
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.
I believe this should return recipes of the requesting user only and there should be a different endpoint in following app for recipes of the following users.
Rename user_profile to created_by in recipe model
Update view to their respective views.py