From b7d63afc9117f3430f253d4fd12b30c1b7500346 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 9 Jan 2016 16:50:39 +0100 Subject: [PATCH] Remove old haystack files --- openslides/agenda/search_indexes.py | 12 ------------ openslides/assignments/search_indexes.py | 12 ------------ openslides/mediafiles/search_indexes.py | 12 ------------ openslides/motions/search_indexes.py | 12 ------------ openslides/users/search_indexes.py | 13 ------------- openslides/utils/haystack_processor.py | 23 ----------------------- 6 files changed, 84 deletions(-) delete mode 100644 openslides/agenda/search_indexes.py delete mode 100644 openslides/assignments/search_indexes.py delete mode 100644 openslides/mediafiles/search_indexes.py delete mode 100644 openslides/motions/search_indexes.py delete mode 100644 openslides/users/search_indexes.py delete mode 100644 openslides/utils/haystack_processor.py diff --git a/openslides/agenda/search_indexes.py b/openslides/agenda/search_indexes.py deleted file mode 100644 index 98319de4c..000000000 --- a/openslides/agenda/search_indexes.py +++ /dev/null @@ -1,12 +0,0 @@ -from haystack import indexes - -from .models import Item - - -class Index(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, use_template=True) - modelfilter_name = "Agenda" # verbose_name of model - modelfilter_value = "agenda.item" # 'app_name.model_name' - - def get_model(self): - return Item diff --git a/openslides/assignments/search_indexes.py b/openslides/assignments/search_indexes.py deleted file mode 100644 index 6bb39dfcc..000000000 --- a/openslides/assignments/search_indexes.py +++ /dev/null @@ -1,12 +0,0 @@ -from haystack import indexes - -from .models import Assignment - - -class Index(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, use_template=True) - modelfilter_name = "Elections" # verbose_name of model - modelfilter_value = "assignments.assignment" # 'app_name.model_name' - - def get_model(self): - return Assignment diff --git a/openslides/mediafiles/search_indexes.py b/openslides/mediafiles/search_indexes.py deleted file mode 100644 index 8854f8a35..000000000 --- a/openslides/mediafiles/search_indexes.py +++ /dev/null @@ -1,12 +0,0 @@ -from haystack import indexes - -from .models import Mediafile - - -class Index(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, use_template=True) - modelfilter_name = "Files" # verbose_name of model - modelfilter_value = "mediafiles.mediafile" # 'app_name.model_name' - - def get_model(self): - return Mediafile diff --git a/openslides/motions/search_indexes.py b/openslides/motions/search_indexes.py deleted file mode 100644 index 8f78acde5..000000000 --- a/openslides/motions/search_indexes.py +++ /dev/null @@ -1,12 +0,0 @@ -from haystack import indexes - -from .models import Motion - - -class Index(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, use_template=True) - modelfilter_name = "Motions" # verbose_name of model - modelfilter_value = "motions.motion" # 'app_name.model_name' - - def get_model(self): - return Motion diff --git a/openslides/users/search_indexes.py b/openslides/users/search_indexes.py deleted file mode 100644 index 001277317..000000000 --- a/openslides/users/search_indexes.py +++ /dev/null @@ -1,13 +0,0 @@ -from haystack import indexes - -from .models import User - - -class Index(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, use_template=True) - text = indexes.EdgeNgramField(document=True, use_template=True) - modelfilter_name = 'Users' # verbose_name of model - modelfilter_value = 'users.user' # 'app_name.model_name' - - def get_model(self): - return User diff --git a/openslides/utils/haystack_processor.py b/openslides/utils/haystack_processor.py deleted file mode 100644 index 7b0141308..000000000 --- a/openslides/utils/haystack_processor.py +++ /dev/null @@ -1,23 +0,0 @@ -from django.db import models -from haystack.signals import RealtimeSignalProcessor - - -class OpenSlidesProcessor(RealtimeSignalProcessor): - def setup(self): - # Naive (listen to all model saves). - super(OpenSlidesProcessor, self).setup() - models.signals.m2m_changed.connect(self.handle_many_to_many) - - def teardown(self): - # Naive (listen to all model saves). - super(OpenSlidesProcessor, self).teardown() - models.signals.m2m_changed.disconnect(self.handle_many_to_many) - - def handle_many_to_many(self, sender, instance, **kwargs): - """ - Given an individual model instance, determine which backends the - update should be sent to & update the object on those backends. - """ - model_class = type(instance) - if kwargs['action'] == 'post_add' or kwargs['action'] == 'post_clear' or kwargs['action'] == 'post_remove': - self.handle_save(model_class, instance, **kwargs)