~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to pybb/models.py

  • Committer: Holger Rapp
  • Date: 2009-03-22 21:24:54 UTC
  • Revision ID: sirver@h566336-20090322212454-kgcadqq213hp4grh
First draft version of search using the sphinx search engine

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
from pybb.markups import mypostmarkup 
14
14
from pybb.util import urlize, memoize_method, unescape
15
15
from pybb import settings as pybb_settings
 
16
from djangosphinx import SphinxSearch
16
17
 
17
18
MARKUP_CHOICES = (
18
19
    ('markdown', 'markdown'),
94
95
    closed = models.BooleanField(_('Closed'), blank=True, default=False)
95
96
    subscribers = models.ManyToManyField(User, related_name='subscriptions', verbose_name=_('Subscribers'), blank=True)
96
97
    post_count = models.IntegerField(_('Post count'), blank=True, default=0)
 
98
    
 
99
    # Django sphinx 
 
100
    search = SphinxSearch(
 
101
        weights = {
 
102
            'name': 100,
 
103
            }
 
104
        )
97
105
 
98
106
    class Meta:
99
107
        ordering = ['-created']
169
177
    body_html = models.TextField(_('HTML version'))
170
178
    body_text = models.TextField(_('Text version'))
171
179
    user_ip = models.IPAddressField(_('User IP'), blank=True, default='')
 
180
    
 
181
    # Django sphinx 
 
182
    search = SphinxSearch(
 
183
        weights = {
 
184
            'body_text': 100,
 
185
            'body_html': 0,
 
186
            }
 
187
        )
172
188
 
173
189
 
174
190
    class Meta: