Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
only allowing comments for two months per issue
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed Aug 31, 2009
1 parent 574a489 commit 06dc424
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fu/models.py
@@ -1,6 +1,7 @@
from django.db import models from django.db import models
from sorl.thumbnail.fields import ImageWithThumbnailsField from sorl.thumbnail.fields import ImageWithThumbnailsField
import re import re
from datetime import datetime, timedelta


class Author(models.Model): class Author(models.Model):
class Admin: class Admin:
Expand Down Expand Up @@ -220,7 +221,12 @@ def is_cartoon(self):
return self.atype == "cartoon" return self.atype == "cartoon"


def comments_allowed(self): 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 Image(models.Model):
class Admin: class Admin:
Expand Down

0 comments on commit 06dc424

Please sign in to comment.