diff --git a/django_setup_configuration/base.py b/django_setup_configuration/base.py index 1ba6202..59294d9 100644 --- a/django_setup_configuration/base.py +++ b/django_setup_configuration/base.py @@ -172,6 +172,3 @@ def create_config_fields( ) self.config_fields.append(config_field) - - def get_required_settings(self) -> list[str]: - return [self.get_setting_name(field) for field in self.config_fields.required] diff --git a/django_setup_configuration/management/commands/generate_config_docs.py b/django_setup_configuration/management/commands/generate_config_docs.py index 88ad863..ca60a93 100644 --- a/django_setup_configuration/management/commands/generate_config_docs.py +++ b/django_setup_configuration/management/commands/generate_config_docs.py @@ -59,7 +59,7 @@ def render_doc(self, config_settings: ConfigSettingsModel, config_step) -> None: title = self.format_display_name(config_step.verbose_name) template_variables = { - "enable_settings": enable_setting, + "enable_setting": enable_setting, "required_settings": required_settings, "all_settings": all_settings, "detailed_info": detailed_info, diff --git a/django_setup_configuration/templates/django_setup_configuration/config_doc.rst b/django_setup_configuration/templates/django_setup_configuration/config_doc.rst index 48deaf8..ae6d494 100644 --- a/django_setup_configuration/templates/django_setup_configuration/config_doc.rst +++ b/django_setup_configuration/templates/django_setup_configuration/config_doc.rst @@ -5,14 +5,14 @@ Settings Overview ================= +{% if enable_setting %} Enable/Disable configuration: """"""""""""""""""""""""""""" -{% if required_settings %} :: {% spaceless %} - {{ enable_settings }} + {{ enable_setting }} {% endspaceless %} {% endif %} diff --git a/tests/mocks.py b/tests/mocks.py index b352a3f..b2a99aa 100644 --- a/tests/mocks.py +++ b/tests/mocks.py @@ -1,2 +1,2 @@ -mock_user_doc = '.. _user:\n\n==================\nUser Configuration\n==================\n\nSettings Overview\n=================\n\nEnable/Disable configuration:\n"""""""""""""""""""""""""""""\n\n::\n\n USER_CONFIGURATION_ENABLED\n\n\nRequired:\n"""""""""\n\n::\n\n USER_CONFIGURATION_PASSWORD\n USER_CONFIGURATION_USERNAME\n\n\nAll settings:\n"""""""""""""\n\n::\n\n USER_CONFIGURATION_EMAIL\n USER_CONFIGURATION_FIRST_NAME\n USER_CONFIGURATION_IS_STAFF\n USER_CONFIGURATION_IS_SUPERUSER\n USER_CONFIGURATION_LAST_NAME\n USER_CONFIGURATION_PASSWORD\n USER_CONFIGURATION_USERNAME\n\nDetailed Information\n====================\n\n::\n\n Variable USER_CONFIGURATION_EMAIL\n Setting email address\n Description No description\n Possible values string representing an Email address (foo@bar.com)\n Default value No default\n \n Variable USER_CONFIGURATION_FIRST_NAME\n Setting first name\n Description No description\n Possible values string\n Default value No default\n \n Variable USER_CONFIGURATION_IS_STAFF\n Setting staff status\n Description Designates whether the user can log into this admin site.\n Possible values True, False\n Default value False\n \n Variable USER_CONFIGURATION_IS_SUPERUSER\n Setting superuser status\n Description Designates that this user has all permissions without explicitly assigning them.\n Possible values True, False\n Default value False\n \n Variable USER_CONFIGURATION_LAST_NAME\n Setting last name\n Description No description\n Possible values string\n Default value No default\n \n Variable USER_CONFIGURATION_PASSWORD\n Setting password\n Description No description\n Possible values string\n Default value No default\n \n Variable USER_CONFIGURATION_USERNAME\n Setting username\n Description Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.\n Possible values string\n Default value No default\n' # noqua +mock_user_doc = '.. _user:\n\n==================\nUser Configuration\n==================\n\nSettings Overview\n=================\n\nEnable/Disable configuration:\n"""""""""""""""""""""""""""""\n\n::\n\n \n\n\nRequired:\n"""""""""\n\n::\n\n USER_CONFIGURATION_PASSWORD\n USER_CONFIGURATION_USERNAME\n\n\nAll settings:\n"""""""""""""\n\n::\n\n USER_CONFIGURATION_EMAIL\n USER_CONFIGURATION_FIRST_NAME\n USER_CONFIGURATION_IS_STAFF\n USER_CONFIGURATION_IS_SUPERUSER\n USER_CONFIGURATION_LAST_NAME\n USER_CONFIGURATION_PASSWORD\n USER_CONFIGURATION_USERNAME\n\nDetailed Information\n====================\n\n::\n\n Variable USER_CONFIGURATION_EMAIL\n Setting email address\n Description No description\n Possible values string representing an Email address (foo@bar.com)\n Default value No default\n \n Variable USER_CONFIGURATION_FIRST_NAME\n Setting first name\n Description No description\n Possible values string\n Default value No default\n \n Variable USER_CONFIGURATION_IS_STAFF\n Setting staff status\n Description Designates whether the user can log into this admin site.\n Possible values True, False\n Default value False\n \n Variable USER_CONFIGURATION_IS_SUPERUSER\n Setting superuser status\n Description Designates that this user has all permissions without explicitly assigning them.\n Possible values True, False\n Default value False\n \n Variable USER_CONFIGURATION_LAST_NAME\n Setting last name\n Description No description\n Possible values string\n Default value No default\n \n Variable USER_CONFIGURATION_PASSWORD\n Setting password\n Description No description\n Possible values string\n Default value No default\n \n Variable USER_CONFIGURATION_USERNAME\n Setting username\n Description Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.\n Possible values string\n Default value No default\n' # noqua mock_user_doc_mismatch = "hello world"