Skip to content

Instantly share code, notes, and snippets.

View paoloromolini's full-sized avatar

Paolo Romolini paoloromolini

View GitHub Profile
@Cloudo
Cloudo / paginators.py
Created March 17, 2016 14:45
Django Paginators
from django.core.cache import caches
from django.core.paginator import Paginator
from django.db import connections
class LargeTablePaginator(Paginator):
"""
Overrides the count method to get an estimate instead of actual count when not filtered
"""
def _get_count(self):
"""
from django.contrib.admin import ModelAdmin
class MyTableAdmin(ModelAdmin):
...
paginator = LargeTablePaginator
...
@andyvanee
andyvanee / .ssh_config
Last active November 30, 2023 04:19
Fix unix_listener too long for Unix domain socket
Host *
ControlPath ~/.ssh/control/%C
ControlMaster auto