Permalink
Browse files

only allowing comments for two months per issue

  • Loading branch information...
1 parent 574a489 commit 06dc42486dd651831c5c94f2d34b5f65cadc1c8a @thraxil committed Aug 31, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 fu/models.py
View
@@ -1,6 +1,7 @@
from django.db import models
from sorl.thumbnail.fields import ImageWithThumbnailsField
import re
+from datetime import datetime, timedelta
class Author(models.Model):
class Admin:
@@ -220,7 +221,12 @@ def is_cartoon(self):
return self.atype == "cartoon"
def comments_allowed(self):
- return self.issue.is_current()
+ """ comments only allowed on current issue and only
+ for two months """
+ if not self.issue.is_current():
+ return False
+ now = datetime.now()
+ return self.issue.pub_date + timedelta(weeks=8) > now
class Image(models.Model):
class Admin:

0 comments on commit 06dc424

Please sign in to comment.