added is_pushed and some "styling"
This commit is contained in:
@@ -11,7 +11,7 @@ from django.utils.safestring import mark_safe
|
||||
from filer.fields.file import FilerFileField
|
||||
|
||||
from lib.core.db.models.base import SharedPermissionBase
|
||||
from lib.core.db.models.mixins import DateAware, AuthorAware, DescriptionAware, NameAware
|
||||
from lib.core.db.models.mixins import DateAware, AuthorAware, DescriptionAware, NameAware, PublishedAware
|
||||
|
||||
|
||||
class MediaFile(NameAware, DateAware, AuthorAware, DescriptionAware):
|
||||
@@ -62,7 +62,7 @@ class SharedQuestion(SharedPermissionBase):
|
||||
abstract = False
|
||||
|
||||
|
||||
class Question(DateAware, AuthorAware, DescriptionAware):
|
||||
class Question(DateAware, AuthorAware, PublishedAware, DescriptionAware):
|
||||
name = models.CharField(max_length=500, unique=True, db_index=True)
|
||||
question = models.TextField(db_index=True)
|
||||
buzzword = models.CharField(max_length=25, null=True, blank=True)
|
||||
@@ -90,8 +90,10 @@ class Question(DateAware, AuthorAware, DescriptionAware):
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_by_tearchterm(term):
|
||||
return Question.objects.filter(Question.searchdomain(term)).annotate(cnt=models.Count('id'))
|
||||
def get_by_tearchterm(term, queryset=None):
|
||||
if not queryset:
|
||||
queryset = Question.objects
|
||||
return queryset.filter(Question.searchdomain(term)).annotate(cnt=models.Count('id'))
|
||||
|
||||
|
||||
def to_view(self, for_players: bool = False):
|
||||
|
||||
Reference in New Issue
Block a user