be2bb9edeb72ce15e167be938ff50fab6923eff5
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')
10 def __unicode__(self
):
15 return do_search(self
.string
)
19 class GalleryWidget(Entity
):
20 page
= ManyToOne('UserPage')
21 search
= ManyToOne(SavedSearch
)
23 # NOTE: no longer needed now that we have pages, I guess.
24 # displayer = ManyToOne('User') # determines whose page should it should show up on
25 # # Could be no-ones, if it's just a template.
27 # Needs some fields for position on your page
34 def string(self
, value
):
35 # TODO: should we delete the possibly orphaned saved search?
36 # if not self.displayer:
37 # # TODO: may have to refactor this into an init if the key ordering is inconvenienc
38 # raise "Oh no! This gallery needs a displayer to set on the saved search."
40 self
.search
= SavedSearch(author
=getattr(self
,"author",None), string
=value
)