Skip to content

Commit

Permalink
Return default app CHOICES_LIMIT to old location
Browse files Browse the repository at this point in the history
  • Loading branch information
insspb committed Jun 14, 2023
1 parent ac3ce65 commit 3324733
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions sphinxcontrib_django/docstrings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .. import __version__
from .attributes import improve_attribute_docstring
from .classes import improve_class_docstring
from .config import EXCLUDE_MEMBERS, INCLUDE_MEMBERS
from .config import CHOICES_LIMIT, EXCLUDE_MEMBERS, INCLUDE_MEMBERS
from .data import improve_data_docstring
from .methods import improve_method_docstring

Expand Down Expand Up @@ -62,7 +62,7 @@ def setup(app):
# Set default of django_show_db_tables to False
app.add_config_value("django_show_db_tables", False, True)
# Integer amount of model field choices to show
app.add_config_value("django_choices_to_show", 10, True)
app.add_config_value("django_choices_to_show", CHOICES_LIMIT, True)
# Setup Django after config is initialized
app.connect("config-inited", setup_django)

Expand Down Expand Up @@ -109,7 +109,7 @@ def setup_django(app, config):
raise ConfigError(
"The module you specified in the configuration 'django_settings' in your"
" conf.py cannot be imported. Make sure the module path is correct and the"
" source directoy is added to sys.path."
" source directory is added to sys.path."
) from e
os.environ["DJANGO_SETTINGS_MODULE"] = config.django_settings
django.setup()
Expand Down
4 changes: 4 additions & 0 deletions sphinxcontrib_django/docstrings/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
"polymorphic_primary_key_name",
"polymorphic_super_sub_accessors_replaced",
}

#: How many choices should be shown for model fields by default,
#: used as default for ``django_choices_to_show`` option
CHOICES_LIMIT = 10
3 changes: 1 addition & 2 deletions tests/roots/test-docstrings/dummy_django_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from django.contrib.contenttypes.models import ContentType
from django.db import models

#: Default value of ``django_choices_to_show``
CHOICES_LIMIT = 10
from sphinxcontrib_django.docstrings.config import CHOICES_LIMIT

try:
from phonenumber_field.modelfields import PhoneNumberField
Expand Down

0 comments on commit 3324733

Please sign in to comment.