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

As a user I want to be able to filter posts by role. #59

Open
mathiasbrito-dci opened this issue Jul 18, 2022 · 7 comments · May be fixed by #74
Open

As a user I want to be able to filter posts by role. #59

mathiasbrito-dci opened this issue Jul 18, 2022 · 7 comments · May be fixed by #74

Comments

@mathiasbrito-dci
Copy link
Contributor

As a user, I must be able to retrieve a list of posts filtered by the creator's role. e.g., by teacher, by student, by researcher, etc.

@lamalul
Copy link

lamalul commented Aug 23, 2022

@mathiasbrito-dci @divyaChandran10
the role attribute has been deleted. Is the issue still relevant? we added a method to filter by creator_username, would it be alternative?

class PostViewSet(ModelViewSet):
    queryset = Post.objects.all()
    serializer_class = PostSerializer

    def get_queryset(self):
        search_term = self.request.query_params.get('search_terms')
        if search_term:
            queryset = Post.objects.filter(creator__username__icontains=search_term)
        else:
            queryset = Post.objects.all()
        return queryset

@lamalul
Copy link

lamalul commented Aug 23, 2022

@mathiasbrito-dci shall we add an extra SearchView or is it enough to do the search in the localhost:8000/posts/?search_terms=username ?
e.g. http://127.0.0.1:8000/posts/?search_terms=La

@mathiasbrito-dci
Copy link
Contributor Author

@mathiasbrito-dci @divyaChandran10 the role attribute has been deleted. Is the issue still relevant? we added a method to filter by creator_username, would it be alternative?

we need to think about it, I think we can find a solution without the need of having the role, for example, thinking real quick here, if we want to limit the search by student we can just search on the student table.

@divyaChandran10
Copy link
Contributor

I think, People in general will search any post by title regardless of the role.

@lamalul
Copy link

lamalul commented Aug 24, 2022

@mathiasbrito-dci @divyaChandran10 the role attribute has been deleted. Is the issue still relevant? we added a method to filter by creator_username, would it be alternative?

we need to think about it, I think we can find a solution without the need of having the role, for example, thinking real quick here, if we want to limit the search by student we can just search on the student table.

You mean we make new models for StudentPost, TeacherPost, InsitutionPost?

@lamalul
Copy link

lamalul commented Aug 24, 2022

I think, People in general will search any post by title regardless of the role.

The Issue is about viewing Students/Teacher/Institution posts by just clicking on some filter button. or a link .

@divyaChandran10
Copy link
Contributor

Yes I understood that, but since the role attribute is removed from models, can we do the common search of posts. If yes, we can change the issue as 'Search the posts by Title'.

@lamalul lamalul linked a pull request Aug 29, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants