|
|
@@ -17,7 +17,9 @@
|
|
|
|
|
|
|
|
|
from django import forms
|
|
|
+from django.utils.translation import ugettext as _
|
|
|
from search.models import Collection
|
|
|
+from search_controller import SearchController
|
|
|
|
|
|
|
|
|
class QueryForm(forms.Form):
|
|
|
@@ -63,3 +65,10 @@ class CollectionForm(forms.ModelForm):
|
|
|
class Meta:
|
|
|
model = Collection
|
|
|
exclude = ('facets', 'result', 'sorting', 'properties', 'cores')
|
|
|
+
|
|
|
+ def clean_name(self):
|
|
|
+ searcher = SearchController()
|
|
|
+ name = self.cleaned_data['name']
|
|
|
+ if not searcher.is_collection(name) and not searcher.is_core(name):
|
|
|
+ raise forms.ValidationError(_('No live Solr collection or core by the name %s') % name)
|
|
|
+ return name
|