Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

farhan-arshad-dev
Copy link
Owner

@farhan-arshad-dev farhan-arshad-dev commented Jul 26, 2019

Update view to their respective views.py

@farhan-arshad-dev farhan-arshad-dev changed the title Update view to their respects views.py Update view to their respective views.py Jul 26, 2019
@@ -0,0 +1,3 @@
{

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.

Copy link

@waheedahmed waheedahmed left a 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.

@farhan-arshad-dev
Copy link
Owner Author

@waheedahmed Please have a look in to it PR is ready for another pass.

Copy link

@waheedahmed waheedahmed left a 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

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

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):

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.

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.

None yet

2 participants