コード例 #1
0
ファイル: forms.py プロジェクト: emory-libraries/findingaids
 def __init__(self, *args, **kwargs):
     super(AdvancedSearchForm, self).__init__(*args, **kwargs)
     # generate a list of repository choices
     repo_choices = [("", "All")]  # default option - no filter / all repos
     repo_choices = []
     # distinct list of repositories from eXist db: use exact phrase match for value/search
     repo_choices.extend([('"%s"' % r, r) for r in EadRepository.distinct()])
     self.fields["repository"].choices = repo_choices
     # configure select widget so all choices will be displayed
     self.fields["repository"].widget.attrs["size"] = len(repo_choices)
コード例 #2
0
ファイル: models.py プロジェクト: mprefer/findingaids
 def test_distinct(self):
     repos = EadRepository.distinct()
     # should be a distinct, space-normalized list of subareas
     self.assert_('Pitts Theology Library' in repos)
     self.assert_('Manuscript, Archives, and Rare Book Library' in repos)