-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.py
More file actions
30 lines (20 loc) · 774 Bytes
/
models.py
File metadata and controls
30 lines (20 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from django.db import models
from django.contrib.comments.models import Comment as DjangoComment
from django.contrib.comments.managers import CommentManager
from django.contrib.sites.models import Site
class CommentManager(CommentManager):
def for_site(self, site = None):
if site is None:
site = Site.objects.get_current()
return self.filter(site = site)
def valid(self):
return self.for_site().filter(is_removed = False, is_public = True)
class Comment(DjangoComment):
"""
This is just a fill-in model.
"""
class Meta:
proxy = True
objects = CommentManager()
def __unicode__(self):
return "%s: %s" % (self.user or self.user_name, self.comment)