public
Description: A full featured and opinionated blogging solution using Django
Homepage: http://lethain.com/projects/lifeflow/
Clone URL: git://github.com/lethain/lifeflow.git
lifeflow / search.py
100644 26 lines (19 sloc) 0.763 kb
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
import solango
from lifeflow.models import Comment, Entry
 
class EntryDocument(solango.SearchDocument):
    date = solango.fields.DateField()
    summary = solango.fields.TextField(copy=True)
    title = solango.fields.CharField(copy=True)
    tags = solango.fields.CharField(copy=True)
    content = solango.fields.TextField(copy=True)
 
    def transform_summary(self, instance):
        return instance.summary
 
    def transform_tags(self, instance):
        tags = list(instance.tags.all())
        texts = [ tag.title for tag in tags ]
        return ",".join(texts)
    
    def transform_date(self, instance):
        return instance.pub_date
 
    def transform_content(self, instance):
        return instance.body
 
solango.register(Entry, EntryDocument)