Giter Club home page Giter Club logo

hightop.py's Introduction

Hightop.py

A nice shortcut for group count queries with Django

Visit.objects.top('browser')
# {
#   'Chrome': 63,
#   'Safari': 50,
#   'Firefox': 34
# }

Build Status

Installation

Run:

pip install hightop

Getting Started

Add a custom manager to the models where you want to use it.

from hightop import HightopQuerySet

class Visit(models.Model):
    objects = HightopQuerySet.as_manager()

And query away

Visit.objects.top('browser')

Options

Limit the results

Visit.objects.top('referring_domain', 10)

Include null values

Visit.objects.top('search_keyword', null=True)

Works with multiple groups

Visit.objects.top(['city', 'browser'])

And expressions

Visit.objects.top(Lower('referring_domain'))

And distinct

Visit.objects.top('city', distinct='user_id')

And min count

Visit.objects.top('city', min=10)

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/hightop.py.git
cd hightop.py
pip install -r requirements.txt
pytest

hightop.py's People

Contributors

ankane avatar

Stargazers

Bheem avatar 浮生 avatar jET avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

jet10000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.