Skip to content

Add Download Count Near The Download Icon #648

@Rajeev529

Description

@Rajeev529

When a user sees a snippet (most of them are not logged in or do not have an account), only the score count is displayed. Users read the snippet and, if interested, they definitely click on the download icon. However, users are not able to see how many downloads the snippet has.

The development server is installed on my system, and I am familiar with the code structure and technologies used.

I want to add a simple download count on the snippet so that it is transparent for everyone how many downloads a snippet currently has. This motivates both downloaders and snippet writers to add more snippets.

My approach:
1.) Create a column named download_count in cab_snippet.
2.) Identify the snippet ID clicked (getting the ID via a GET request).
3.) Add a line in the view function download_snippet
(cab_snippet.objects.get(id=id).download_count += 1)
Result:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions