? Earlier 3 items total Later ?

On this page:?

For pkit

entries.get_list(pub_date__year=2005, pub_date__month=11)

lighttpd.conf update for use with Django

If you grabbed my sample lighttpd.conf before I made this post in the forum, then open up your lighttpd.conf, scroll down to the url.rewrite section, and change this:

"^(/[^media]/.*)$" => "/main.fcgi$1"


To this:

"^(/[^media].*)$" => "/main.fcgi$1"

Close comments after a set time in Django apps

If you're using Django's bundled comments application, you might want to have comments for objects closed after a set period of time; to do this, just add a method to the model of the object which will be getting the comments (e.g., the 'Entry' class if you have a weblog), like so (this assumes a DateTimeField called 'pub_date' which represents the object's date of publication):

def allow_comments(self):
    return datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date


Change the timedelta value to however many days you'd like to leave comments open after publication, and now you'll be able to selectively display the comment form only when comments are open, by adding this to your template (assuming the object is being referenced by the name 'entry'):

{% if entry.allow_comments %}
... display the comment form here ...
{% endif %}

? Earlier 3 items total Later ?