Last change
on this file since 4825 was
3737,
checked in by hraban, 16 years ago
|
Adding and editing of all objects works now. Templates enhanced (not only for debugging). Still no tests. Added SVN-IDs.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
File size:
1010 bytes
|
Line | |
---|
1 | # $Id: catalog.py 3737 2008-10-26 19:14:17Z hraban $ |
---|
2 | import grok, grok.index |
---|
3 | from hurry.query.query import Query, Text |
---|
4 | from hurry.query import Eq |
---|
5 | from waeup.app import University |
---|
6 | from waeup.students.interfaces import IStudent, IStudentContainer |
---|
7 | from waeup.students.student import Student |
---|
8 | from waeup.viewlets import MainArea, LeftSidebar |
---|
9 | |
---|
10 | class StudentIndexes(grok.Indexes): |
---|
11 | grok.site(University) |
---|
12 | grok.name('students_catalog') |
---|
13 | grok.context(IStudentContainer) |
---|
14 | |
---|
15 | name = grok.index.Field(attribute='name') |
---|
16 | |
---|
17 | |
---|
18 | class StudentSearch(grok.Viewlet): |
---|
19 | grok.context(IStudentContainer) |
---|
20 | grok.viewletmanager(LeftSidebar) |
---|
21 | #grok.view(Student) |
---|
22 | grok.order(3) |
---|
23 | |
---|
24 | def update(self, query=None): |
---|
25 | self.search_result = [] |
---|
26 | if query is not None: |
---|
27 | self.search_result = self.search_context(query) |
---|
28 | print "RESULT: ", list(self.search_result) |
---|
29 | |
---|
30 | def search_context(self, query): |
---|
31 | result = Query().searchResults( |
---|
32 | Eq(('students_catalog', 'name'), query) |
---|
33 | ) |
---|
34 | return result |
---|
35 | |
---|
Note: See
TracBrowser for help on using the repository browser.