+ page = ManyToOne('UserPage', required=True)
+ search = ManyToOne(SavedSearch, required=True)
+
+ def __init__(self, string=None, **kwargs):
+ owner = kwargs.get('owner', None)
+ if string:
+ self.search = SavedSearch(author=owner, string=string)
+
+ page = kwargs.get('page', None)
+ if owner and not page:
+ page = author.primary_page
+
+ super(GalleryWidget, self).__init__(**kwargs)
+