Search
Categories
Category Archives: Django
Repeating Sections in a Django Template
I have a need to have multiple sections of name/value pairs with a header on some pages. Something like: <div class="row"> <div class="span6"> <div class="row"><div class="span3"><h2>History:</h2></div></div> <div class="row"><div class="span2">Date added to fleet:</div><div class="span2">{{plane.dateAddedToFleet}}</div></div> <div class="row"><div class="span2">Total Flight Time:</div><div class="span2">{{plane.totalFlightTime|asTime}}</div></div> <div … Continue reading
Posted in Django, Python
8 Comments
Rate limiting with django-ratelimit
I was playing around with James Socol’s django-ratelimit tonight. It provides a decorator to rate-limit view functions. Very nice! I wanted to use it for login blocking, and some minor changes helped this out. My forked version of django-ratelimit is … Continue reading
Posted in Django, Python
Leave a comment
Custom Tag to Render Avatar in Django Userena
Here is a simple custom tag to render a users avatar (‘mugshot’) when using Django Userena. It optionally takes width and or height in pixels. Place the following code in /templatetags/my_app_tags.py: your_app/ models.py templatetags/ __init__.py my_app_tags.py from django import template … Continue reading
Posted in Django, Python
Leave a comment
Django Image Field Overwrite with ImageKit
I’m using django-imagekit on a new site. I was having a problem that when a user uploaded a new image for the object, the system would not overwrite the existing image file, but instead would create a new file with … Continue reading
Posted in Django, Python
Leave a comment