Skip to content

Instantly share code, notes, and snippets.

View sam-ghosh's full-sized avatar

Sam G sam-ghosh

View GitHub Profile
@sam-ghosh
sam-ghosh / admin.py
Created October 15, 2022 10:30 — forked from gauravvjn/admin.py
Use JSONField properties in Django admin filter Raw
"""
More details on the implementation and usage can be found at
https://www.pyscoop.com/django-jsonfield-attributes-in-admin-filter/
"""
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
class JSONFieldFilter(admin.SimpleListFilter):
@sam-ghosh
sam-ghosh / url_add_query.py
Created April 1, 2019 11:32 — forked from leonsmith/url_add_query.py
Django template tag to append a query string to a url
from urlparse import urlsplit, urlunsplit
from django import template
from django.http import QueryDict
register = template.Library()
@register.simple_tag
def url_add_query(url, **kwargs):
"""