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