Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / fiddle.html
Created March 15, 2018 01:55
JSGrid Img Field (source: http://jsfiddle.net/ccy9u7pa/125/)
<div id="jsgrid"></div>
<div id="dialog" title="Image Full Size View">
<img id="imagePreview" />
</div>
@mindlace
mindlace / middleware.py
Created October 19, 2012 13:43
Add user created/modified to every model
"""Add user created_by and modified_by foreign key refs to any model automatically.
Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py"""
from django.db.models import signals
from django.utils.functional import curry
class WhodidMiddleware(object):
def process_request(self, request):
if not request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
if hasattr(request, 'user') and request.user.is_authenticated():
user = request.user