aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-08-02 08:38:43 +0530
committerBobby <[email protected]>2022-08-02 08:38:43 +0530
commit673d3a021575a7165372dc449952a64b7b7a857e (patch)
tree28f6367f33bff2e63865668185aaf0e5fc10428c
parentac3deed8be120684a2eb4cec317b7605c396c6f4 (diff)
downloadthatcomputerscientist-673d3a021575a7165372dc449952a64b7b7a857e.tar.xz
thatcomputerscientist-673d3a021575a7165372dc449952a64b7b7a857e.zip
Added template filter for replacing the protocol of user URL with empty string
-rw-r--r--blog/templates/account.html3
-rw-r--r--thatcomputerscientist/settings.py1
-rw-r--r--thatcomputerscientist/templatetags/__init__.py0
-rw-r--r--thatcomputerscientist/templatetags/replace.py8
4 files changed, 11 insertions, 1 deletions
diff --git a/blog/templates/account.html b/blog/templates/account.html
index bf066346..50b58996 100644
--- a/blog/templates/account.html
+++ b/blog/templates/account.html
@@ -12,8 +12,9 @@
</ul>
<p>Your avatar is fetched from gravatar. Update your gravatar email to fetch the avatar. If you don't have an account, you can sign up for one <a href="https://en.gravatar.com/" target="_blank">here</a>. If you haven't set up your gravatar email, we would try to fetch your profile picture from your account email, by default. If your account email and gravatar email are the same, you do not need to set a gravatar email.</p>
{% if user_subdomain_url %}
+ {% load replace %}
<div class="alert" style="padding: 0 10px">
- <p>Your account is publicly accessible at <a href="{{ user_subdomain_url }}">{{ user_subdomain_url }}</a>. If you wish to change your account to private, you can do so below.</p>
+ <p>Your account is publicly accessible at <a href="{{ user_subdomain_url }}">{{ user_subdomain_url|replace:"https://"|replace:"http://" }}</a>. If you wish to change your account to private, you can do so below.</p>
</div>
{% endif %}
{% for message in messages %}
diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py
index 15348189..13d649f5 100644
--- a/thatcomputerscientist/settings.py
+++ b/thatcomputerscientist/settings.py
@@ -44,6 +44,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'thatcomputerscientist',
'blog',
'users',
'userpages',
diff --git a/thatcomputerscientist/templatetags/__init__.py b/thatcomputerscientist/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/thatcomputerscientist/templatetags/__init__.py
diff --git a/thatcomputerscientist/templatetags/replace.py b/thatcomputerscientist/templatetags/replace.py
new file mode 100644
index 00000000..8ed82fa2
--- /dev/null
+++ b/thatcomputerscientist/templatetags/replace.py
@@ -0,0 +1,8 @@
+from django import template
+
+register = template.Library()
+
[email protected](name='replace')
+# Takes two arguments: the string to be replaced and the string to replace it with
+def replace(value, arg):
+ return value.replace(arg, '')