Преглед изворни кода

[search] Default template should display all the fields

Romain Rigaux пре 12 година
родитељ
комит
9a77557

+ 1 - 1
apps/search/src/search/models.py

@@ -187,7 +187,7 @@ class Sorting(models.Model):
 
 class CollectionManager(models.Manager):
 
-  def get_or_create(self, name, solr_properties, is_core_only=False, is_enabled=True):
+  def get_or_create(self, name, solr_properties, is_core_only=False, is_enabled=True, user=None):
     try:
       return self.get(name=name), False
     except Collection.DoesNotExist:

+ 2 - 2
apps/search/src/search/search_controller.py

@@ -67,13 +67,13 @@ class SearchController(object):
       collections = self.get_new_collections()
       collection = collections[attrs['name']]
 
-      hue_collection, created = Collection.objects.get_or_create(name=attrs['name'], solr_properties=collection, is_enabled=True)
+      hue_collection, created = Collection.objects.get_or_create(name=attrs['name'], solr_properties=collection, is_enabled=True, user=self.user)
       return hue_collection
     elif attrs['type'] == 'core':
       cores = self.get_new_cores()
       core = cores[attrs['name']]
 
-      hue_collection, created = Collection.objects.get_or_create(name=attrs['name'], solr_properties=core, is_enabled=True, is_core_only=True)
+      hue_collection, created = Collection.objects.get_or_create(name=attrs['name'], solr_properties=core, is_enabled=True, is_core_only=True, user=self.user)
       return hue_collection
     else:
       raise PopupException(_('Collection type does not exit: %s') % attrs)

+ 1 - 1
apps/search/src/search/templates/admin_collections.mako

@@ -209,7 +209,7 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
     $(document).on("imported", function () {
       $("#importModal").modal("hide");
       $("#importModalBtn").button("reset");
-      $.jHueNotify.info("${ _("Collections imported successfully.") }");
+      $.jHueNotify.info("${ _("Collections imported successfully.") }"); // Could fail actually
     });
 
     $(document).on("deleting", function () {

+ 1 - 1
apps/search/src/search/views.py

@@ -137,7 +137,7 @@ def admin_collections_import(request):
         status += 1
       except Exception, e:
         err_message += unicode(str(e), "utf8") + "\n"
-      result['message'] = status == len(importables) and _('Imported successfully') or _('Imported with errors: ') + err_message
+      result['message'] = _('Imported successfully') if status == len(importables) else _('Imported with errors: ') + err_message
     return HttpResponse(json.dumps(result), mimetype="application/json")
   else:
     if request.GET.get('format') == 'json':