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

Add count attribute to TagSerializer #1612

Closed
jerabekjiri opened this issue Oct 11, 2023 · 1 comment · Fixed by #1621
Closed

Add count attribute to TagSerializer #1612

jerabekjiri opened this issue Oct 11, 2023 · 1 comment · Fixed by #1621

Comments

@jerabekjiri
Copy link
Contributor

jerabekjiri commented Oct 11, 2023

Is your feature request related to a problem? Please describe.

Old galaxy (https://old-galaxy.ansible.com/search) has a list of popular tags. Since we're reusing TagSerializer it would be useful to add this to TagSerializer in pulp_ansible.
Screenshot from 2023-10-10 13-29-31

Describe the solution you'd like
Update TagSerializer with

    count = serializers.SerializerMethodField()

    def get_count(self, obj):
        return obj.ansible_collectionversion.count()

    class Meta:
        model = Tag
        fields = ["name", "count"] 

Describe alternatives you've considered
If this doesn't work out, we can add it to galaxy_ng codebase.

@mdellweg
Copy link
Member

sounds feasible...

jerabekjiri added a commit to jerabekjiri/pulp_ansible that referenced this issue Oct 16, 2023
jerabekjiri added a commit to jerabekjiri/pulp_ansible that referenced this issue Oct 18, 2023
jerabekjiri added a commit to jerabekjiri/pulp_ansible that referenced this issue Oct 18, 2023
jerabekjiri added a commit to jerabekjiri/pulp_ansible that referenced this issue Oct 19, 2023
jerabekjiri added a commit to jerabekjiri/pulp_ansible that referenced this issue Oct 19, 2023
mdellweg pushed a commit that referenced this issue Oct 30, 2023
Add count to TagSerializer

fixes: #1612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants