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