From 89ba77c5285972ed00ab5cdb12bb8e00db8ad647 Mon Sep 17 00:00:00 2001 From: Cyprien de Cerval Date: Fri, 29 Jul 2022 14:29:13 +0200 Subject: [PATCH] feat(custom_link): rename variable and import settings correctly --- docker/settings_local.template.py | 4 ++-- re2o/settings_local.example.py | 4 ++-- re2o/templatetags/custom_link.py | 7 ++++--- templates/nav.html | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docker/settings_local.template.py b/docker/settings_local.template.py index ac09229f..a687a35a 100644 --- a/docker/settings_local.template.py +++ b/docker/settings_local.template.py @@ -100,5 +100,5 @@ OPTIONNAL_APPS_RE2O = () # Some Django apps you want to add in you local project OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + () -# Some optinnal link for the navbar in a tuple (link,class,text) -OPTIONNAL_LINK_RE2O = () \ No newline at end of file +# Some optinnal link for the navbar in a tuple (link,icon class,text) +NAVBAR_LINKS = () \ No newline at end of file diff --git a/re2o/settings_local.example.py b/re2o/settings_local.example.py index 37f179f1..e1ec3d3e 100644 --- a/re2o/settings_local.example.py +++ b/re2o/settings_local.example.py @@ -118,8 +118,8 @@ OPTIONNAL_APPS_RE2O = () # Some Django apps you want to add in you local project OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + () -# Some optinnal link for the navbar in a tuple (link,class,text) -OPTIONNAL_LINK_RE2O = () +# Some optinnal link for the navbar in a tuple (link,icon class,text) +NAVBAR_LINKS= () # Add statiffiles dir that were installed using system packaging # Example to reproduce re2o2.9 behavior diff --git a/re2o/templatetags/custom_link.py b/re2o/templatetags/custom_link.py index 5e062643..7b51897a 100644 --- a/re2o/templatetags/custom_link.py +++ b/re2o/templatetags/custom_link.py @@ -17,12 +17,13 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.from django import template -from re2o.settings_local import OPTIONNAL_LINK_RE2O +from django import template +from django.conf import settings register = template.Library() @register.simple_tag -def nav_link_nologin(): +def nav_link(): template = """
  • @@ -31,6 +32,6 @@ def nav_link_nologin():
  • """ res = "" - for link in OPTIONNAL_LINK_RE2O: + for link in settings.NAVBAR_LINKS: res += template.format(link[0],link[1],link[2]) return res \ No newline at end of file diff --git a/templates/nav.html b/templates/nav.html index 6dc6e84c..4ae0d43b 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -266,7 +266,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %} {% autoescape off %} - {% nav_link_nologin %} + {% nav_link %} {% endautoescape %}