Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: auto_indexing=False not taken into account when calling algoliasearch_django.register #276

Open
gregsadetsky opened this issue Dec 4, 2018 · 1 comment

Comments

@gregsadetsky
Copy link

  • Django version: 2.1.3
  • Algolia Django integration version: 1.7.0
  • Algolia Client Version: 1.17.0
  • Language Version: 3.6.6

Description

registration.py's register accepts an auto_indexing keyword (definition). Unfortunately, setting it to False has no effect as:

  • the AUTO_INDEXING setting is initially read; if it's absent, the internal variable __auto_indexing is set to a default of True
  • an incorrect check is made here: either the auto_indexing is a bool and its value is True OR self.__auto_indexing is True. Since self.__auto_indexing is True by default, passing auto_indexing=False to register does not do anything.

Steps To Reproduce

  • do not set the AUTO_INDEXING setting
  • use code similar to:
# index.py
from algoliasearch_django import register, AlgoliaIndex
from models import MyModel

class MyModelIndex(AlgoliaIndex):
  # ...

register(MyModel, MyModelIndex, auto_indexing=False)

# somewhere else
m = MyModel()
m.save()
# at this point, __post_save_receiver gets called
@tkrugg
Copy link
Contributor

tkrugg commented Jan 26, 2021

Hi @gregsadetsky that's a great point. This PR is addressing it #305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants