Login

Snippets by Mogga

Snippet List

Letterbox for sorl-thumbnail

This custom processor is meant for use with sorl-thumbnail to add letterboxing functionality. Add to your THUMBNAIL_PROCESSORS like so: `THUMBNAIL_PROCESSORS = ( 'sorl.thumbnail.processors.colorspace', 'sorl.thumbnail.processors.autocrop', 'sorl.thumbnail.processors.scale_and_crop', 'sorl.thumbnail.processors.filters', # custom processors 'utils.processors.ltbx', ) ` and then use in your templates like so: ` {% thumbnail model.img_field 200x150 ltbx as thumb %} <img src="{{ thumb }}" width="{{ thumb.width }}" height="{{ thumb.height }}" />` Enjoy.

  • image
  • processor
  • sorl
Read More

LDAP to Django Synchronization

I needed to be able to synchronize my LDAP users and groups to the Django database. This may not be as efficient as some might like but it works like a charm. It returns a list of messages that I pipe into request.user.messages in my template.

  • user
  • auth
  • ldap
  • group
Read More

Mogga has posted 3 snippets.