X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/332de9696e2cca102332d5543adad9b289c35214..422dfbb85e3efd51efd676779012aeb3f9575ba4:/floof/model/search.py diff --git a/floof/model/search.py b/floof/model/search.py index e812afc..01d45a2 100644 --- a/floof/model/search.py +++ b/floof/model/search.py @@ -6,10 +6,10 @@ from floof.lib.search import do_search class SavedSearch(Entity): string = Field(Unicode) # I tried calling this query, but it broke elixir author = ManyToOne('User') - + def __unicode__(self): return self.string - + @property def results(self): return do_search(self.string) @@ -17,26 +17,24 @@ class SavedSearch(Entity): class GalleryWidget(Entity): + page = ManyToOne('UserPage') search = ManyToOne(SavedSearch) - displayer = ManyToOne('User') # determines whose page should it should show up on - # Could be no-ones, if it's just a template. - + + # NOTE: no longer needed now that we have pages, I guess. + # displayer = ManyToOne('User') # determines whose page should it should show up on + # # Could be no-ones, if it's just a template. + # Needs some fields for position on your page @property def string(self): return self.search - + @string.setter def string(self, value): # TODO: should we delete the possibly orphaned saved search? - if not self.displayer: - # TODO: may have to refactor this into an init if the key ordering is inconvenienc - raise "Oh no! This gallery needs a displayer to set on the saved search." - - self.search = SavedSearch(author=self.displayer, string=value) - - -# class UserPage(Entity): -# owner = ManyToOne('User') -# visible = Field(Boolean) \ No newline at end of file + # if not self.displayer: + # # TODO: may have to refactor this into an init if the key ordering is inconvenienc + # raise "Oh no! This gallery needs a displayer to set on the saved search." + + self.search = SavedSearch(author=getattr(self,"author",None), string=value)