mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Extra context variables
This commit is contained in:
parent
101060e6e5
commit
3de7837ac2
6 changed files with 24 additions and 4 deletions
|
@ -26,6 +26,15 @@ class dpasteAppConfig(AppConfig):
|
||||||
# """
|
# """
|
||||||
EXTRA_HEAD_HTML = ""
|
EXTRA_HEAD_HTML = ""
|
||||||
|
|
||||||
|
# HTML content injected in the About page
|
||||||
|
EXTRA_POST_ABOUT = ""
|
||||||
|
|
||||||
|
# HTML content injeted after the "New snippet" form
|
||||||
|
EXTRA_POST_NEW =""
|
||||||
|
|
||||||
|
# HTML content injected at the end of every form
|
||||||
|
EXTRA_POST_FORM = ""
|
||||||
|
|
||||||
# Integer. Length of the random slug for each new snippet. In the rare
|
# Integer. Length of the random slug for each new snippet. In the rare
|
||||||
# case an existing slug is generated again, the length will increase by
|
# case an existing slug is generated again, the length will increase by
|
||||||
# one more character.
|
# one more character.
|
||||||
|
@ -629,4 +638,7 @@ class dpasteAppConfig(AppConfig):
|
||||||
return {
|
return {
|
||||||
"dpaste_application_name": self.APPLICATION_NAME,
|
"dpaste_application_name": self.APPLICATION_NAME,
|
||||||
"dpaste_extra_head_html": mark_safe(self.EXTRA_HEAD_HTML),
|
"dpaste_extra_head_html": mark_safe(self.EXTRA_HEAD_HTML),
|
||||||
|
"dpaste_extra_post_about": mark_safe(self.EXTRA_POST_ABOUT),
|
||||||
|
"dpaste_extra_post_new": mark_safe(self.EXTRA_POST_NEW),
|
||||||
|
"dpaste_extra_post_form": mark_safe(self.EXTRA_POST_FORM),
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,11 @@ DATABASES = {
|
||||||
# add that webserver right away.
|
# add that webserver right away.
|
||||||
try:
|
try:
|
||||||
import django_webserver
|
import django_webserver
|
||||||
INSTALLED_APPS.append('django_webserver')
|
|
||||||
sys.stdout.write(f'\n🚀 Production webserver installed. Will run on port {env("PORT")}\n')
|
INSTALLED_APPS.append("django_webserver")
|
||||||
|
sys.stdout.write(
|
||||||
|
f'\n🚀 Production webserver installed. Will run on port {env("PORT")}\n'
|
||||||
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Settings for the testsuite runs.
|
Settings for the testsuite runs.
|
||||||
"""
|
"""
|
||||||
|
import django
|
||||||
from .base import * # noqa
|
from .base import * # noqa
|
||||||
|
|
||||||
SECRET_KEY = "test-key"
|
SECRET_KEY = "test-key"
|
||||||
|
@ -11,6 +12,5 @@ DATABASES = {
|
||||||
|
|
||||||
# Drop CSP middleware for Django 3.0 until it was fixed upstream
|
# Drop CSP middleware for Django 3.0 until it was fixed upstream
|
||||||
# https://github.com/mozilla/django-csp/issues/129
|
# https://github.com/mozilla/django-csp/issues/129
|
||||||
import django
|
|
||||||
if django.get_version().startswith("3."):
|
if django.get_version().startswith("3."):
|
||||||
MIDDLEWARE.remove("csp.middleware.CSPMiddleware")
|
MIDDLEWARE.remove("csp.middleware.CSPMiddleware")
|
||||||
|
|
|
@ -20,5 +20,7 @@
|
||||||
<a href="https://github.com/bartTC/dpaste">on Github</a>.
|
<a href="https://github.com/bartTC/dpaste">on Github</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{{ dpaste_extra_post_about }}
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -36,5 +36,7 @@
|
||||||
<label for="{{ form.content.auto_id }}">{% trans "Content" %}</label>
|
<label for="{{ form.content.auto_id }}">{% trans "Content" %}</label>
|
||||||
{{ form.content }}
|
{{ form.content }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{{ dpaste_extra_post_form }}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,5 @@
|
||||||
|
|
||||||
{% block page %}
|
{% block page %}
|
||||||
{% include "dpaste/includes/form.html" %}
|
{% include "dpaste/includes/form.html" %}
|
||||||
|
{{ dpaste_extra_post_new }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue