2 # from users import User
4 from floof
.lib
.search
import do_search
6 class SavedSearch(Entity
):
7 string
= Field(Unicode
) # I tried calling this query, but it broke elixir
8 author
= ManyToOne('User')
9 fork
= ManyToOne("SavedSearch")
11 def __unicode__(self
):
16 return do_search(self
.string
)
20 class GalleryWidget(Entity
):
21 page
= ManyToOne('UserPage')
22 search
= ManyToOne(SavedSearch
)
24 # NOTE: no longer needed now that we have pages, I guess.
25 # displayer = ManyToOne('User') # determines whose page should it should show up on
26 # # Could be no-ones, if it's just a template.
28 # Needs some fields for position on your page
35 def string(self
, value
):
36 # TODO: should we delete the possibly orphaned saved search?
37 # if not self.displayer:
38 # # TODO: may have to refactor this into an init if the key ordering is inconvenienc
39 # raise "Oh no! This gallery needs a displayer to set on the saved search."
41 self
.search
= SavedSearch(author
=getattr(self
,"author",None), string
=value
)