Recent Scroll Updates
@ Feb. 22, 2009, 8:22 p.m.
Filed under: Django Code Tech Scroll Python
My dog killed my old laptop by jumping on it so I decided to do some work on scroll (don't question it). Here are some updates to the code base currently in git:
templates reside in app directories
supports more ping services: Technorati, Google, Weblogs, Syndicate, Feedburner and Icerocket
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Django MixIn To Not Define __unicode__ Method @ Jan. 4, 2009, 8:11 p.m.
Filed under: Django Tech Python
A lot of the models I make just need to return one instance variable as it's 'name' and defining __unicode__ method for each one just to change the instance variable seemed to be a waste of time. So here is what I did so I can type less.
Here is an example using the class variable name as the Unicode representation...
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Scroll On Ohloh And More @ Dec. 24, 2008, 12:25 p.m.
Filed under: Django Code Tech Scroll Python
It's finally there .... I'm just lazy sometimes :-).
Some other things in the pipeline for the next release are:
* added multiple pinging services and moved receiver code into a nicer form
* added google and technorati ping signal catchers
* added gravatar support
* super basic comment support
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Full Featured Django Gravatar Tag @ Dec. 14, 2008, 12:21 a.m.
Filed under: Django Code Tech Scroll Python
After looking at the simple implementations others had done, and always disliking when something is only half implemented, I threw together a Django tag that creates full Gravatar url's.
Also see: Django Snippets Post
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Django Command Extensions @ Sept. 30, 2008, 10:40 p.m.
Filed under: Django Code Tech Python
I'm looking forward to the next release of Django Command Extensions. This post pointed me to it and it looks quite awesome! See this screencast for some cool stuff it does.
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Filed under: Django Code Tech Scroll Python
My dog killed my old laptop by jumping on it so I decided to do some work on scroll (don't question it). Here are some updates to the code base currently in git:
templates reside in app directories
supports more ping services: Technorati, Google, Weblogs, Syndicate, Feedburner and Icerocket
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Django MixIn To Not Define __unicode__ Method @ Jan. 4, 2009, 8:11 p.m.
Filed under: Django Tech Python
A lot of the models I make just need to return one instance variable as it's 'name' and defining __unicode__ method for each one just to change the instance variable seemed to be a waste of time. So here is what I did so I can type less.
from django.db import models
class UnicodeReprMixIn(object):
"""
Adds a unicode representation using self._unicode.
"""
def __unicode__(self):
"""
Unocode representation of this instance.
"""
return unicode(self.__getattribute__(self._unicode))
Here is an example using the class variable name as the Unicode representation...
class Company(models.Model, UnicodeReprMixIn):
"""
A representation of a comic book company.
"""
name = models.CharField(max_length=255)
slug = models.SlugField()
logo = models.ImageField(upload_to=os.path.join('upload', 'company_logos'))
url = models.URLField(verify_exists=True)
_unicode = "name"
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Scroll On Ohloh And More @ Dec. 24, 2008, 12:25 p.m.
Filed under: Django Code Tech Scroll Python
It's finally there .... I'm just lazy sometimes :-).
Some other things in the pipeline for the next release are:
* added multiple pinging services and moved receiver code into a nicer form
* added google and technorati ping signal catchers
* added gravatar support
* super basic comment support
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Full Featured Django Gravatar Tag @ Dec. 14, 2008, 12:21 a.m.
Filed under: Django Code Tech Scroll Python
After looking at the simple implementations others had done, and always disliking when something is only half implemented, I threw together a Django tag that creates full Gravatar url's.
from hashlib import md5
from django import template
# We call it avatar_url instead of gravatar_url so if we change services in the
# future it's just a change of the tag.
@register.simple_tag
def avatar_url(email, size=50, rating='g', default=None):
"""
Returns a gravatar url.
Example tag usage: {% avatar user.email 80 "g" %}
:Parameters:
- `email`: the email to send to gravatar.
- `size`: optional YxY size for the image.
- `rating`: optional rating (g, pg, r, or x) of the image.
- `default`: optional default image url or hosted image like wavatar.
"""
# Verify the rating actually is a rating accepted by gravatar
rating = rating.lower()
ratings = ['g', 'pg', 'r', 'x']
if rating not in ratings:
raise template.TemplateSyntaxError('rating must be %s' % (
", ".join(ratings)))
# Create and return the url
hash = md5(email).hexdigest()
url = 'http://www.gravatar.com/avatar/%s?s=%s&r=%s' % (
hash, size, rating)
if default:
url = "%s&d=%s" % (url, default)
return url
Also see: Django Snippets Post
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Django Command Extensions @ Sept. 30, 2008, 10:40 p.m.
Filed under: Django Code Tech Python
I'm looking forward to the next release of Django Command Extensions. This post pointed me to it and it looks quite awesome! See this screencast for some cool stuff it does.
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0

