A nice shortcut for group count queries with Django
Project description
Hightop.py
A nice shortcut for group count queries with Django
Visit.objects.top('browser')
# {
# 'Chrome': 63,
# 'Safari': 50,
# 'Firefox': 34
# }
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:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/hightop.py.git
cd hightop.py
pip install -r requirements.txt
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hightop-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: hightop-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ca97b41ad51c6dbea51d32a2e32174f3b24374f8bae65eec7c5e3707b18de8c
|
|
| MD5 |
08fdf51d3c671fbc8902bda2a56bc874
|
|
| BLAKE2b-256 |
3b4b03382d9c92159c938dba07e7ca7750281393300452dacfe44def2abbf06f
|