diff --git a/snipts/templatetags/snipt_tags.py b/snipts/templatetags/snipt_tags.py index 120baff..d48a839 100644 --- a/snipts/templatetags/snipt_tags.py +++ b/snipts/templatetags/snipt_tags.py @@ -1,4 +1,5 @@ import hashlib +import os from django import template from snipts.models import Favorite, Snipt @@ -42,6 +43,12 @@ def snipts_count_for_user(context): return snipts +@tag(register, [Constant('as'), Variable()]) +def signup_enabled(context, asvar): + context[asvar] = os.environ.get("DISABLE_SIGNUP") != "true" + return '' + + @tag(register, [Constant('as'), Variable()]) def get_lexers(context, asvar): context[asvar] = get_lexers_list() diff --git a/templates/base.html b/templates/base.html index 9970282..346efd3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,5 +1,7 @@ {% load snipt_tags static %} +{% signup_enabled as 'signup_is_enabled' %} +
@@ -92,6 +94,11 @@