kopia lustrzana https://github.com/rtts/django-simplecms
Various small improvements
rodzic
b092c12c99
commit
c552f52e46
|
@ -8,6 +8,7 @@ example_dir=$(python3 -c 'import os,example;print(os.path.dirname(example.__file
|
|||
cp -r "$example_dir" "$1"
|
||||
cp "$example_dir"/../manage.py .
|
||||
sed -i "s/example/$1/" manage.py
|
||||
sed -i "s/example/$1/" "$1"/wsgi.py
|
||||
cat << EOF > .gitignore
|
||||
*.pyc
|
||||
__pycache__/
|
||||
|
|
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-02-20 22:46+0100\n"
|
||||
"PO-Revision-Date: 2020-02-20 22:48+0100\n"
|
||||
"POT-Creation-Date: 2020-03-24 14:49+0100\n"
|
||||
"PO-Revision-Date: 2020-03-24 14:50+0100\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
|
@ -21,103 +21,95 @@ msgstr ""
|
|||
msgid "Content Management System"
|
||||
msgstr "Content Beheer"
|
||||
|
||||
#: forms.py:15
|
||||
#: forms.py:55
|
||||
msgid "Delete"
|
||||
msgstr "Verwijderen"
|
||||
|
||||
#: forms.py:112
|
||||
msgid "Your email address"
|
||||
msgstr "Uw email adres"
|
||||
|
||||
#: forms.py:16 forms.py:17
|
||||
#: forms.py:113 forms.py:114
|
||||
msgid "Your message"
|
||||
msgstr "Uw bericht"
|
||||
|
||||
#: forms.py:32
|
||||
#: forms.py:128
|
||||
#, python-format
|
||||
msgid "Contact form at %(hostname)s."
|
||||
msgstr "%(hostname)s contactformulier"
|
||||
|
||||
#: models.py:63 models.py:87
|
||||
#: models.py:67
|
||||
msgid "page"
|
||||
msgstr "pagina"
|
||||
|
||||
#: models.py:64
|
||||
#: models.py:68
|
||||
msgid "slug"
|
||||
msgstr "slug"
|
||||
|
||||
#: models.py:65 models.py:90
|
||||
#: models.py:69 models.py:93
|
||||
msgid "number"
|
||||
msgstr "nummer"
|
||||
|
||||
#: models.py:66
|
||||
#: models.py:70
|
||||
msgid "visible in menu"
|
||||
msgstr "zichtbaar in het menu"
|
||||
|
||||
#: models.py:70
|
||||
#: models.py:74
|
||||
msgid "New page"
|
||||
msgstr "Nieuwe pagina"
|
||||
|
||||
#: models.py:80
|
||||
#: models.py:84
|
||||
msgid "Page"
|
||||
msgstr "Pagina"
|
||||
|
||||
#: models.py:81
|
||||
#: models.py:85
|
||||
msgid "Pages"
|
||||
msgstr "Pagina’s"
|
||||
|
||||
#: models.py:88 models.py:110
|
||||
#: models.py:91 models.py:115
|
||||
msgid "section"
|
||||
msgstr "sectie"
|
||||
|
||||
#: models.py:89
|
||||
#: models.py:92
|
||||
msgid "type"
|
||||
msgstr "type"
|
||||
|
||||
#: models.py:92
|
||||
#: models.py:94
|
||||
msgid "content"
|
||||
msgstr "inhoud"
|
||||
|
||||
#: models.py:93
|
||||
#: models.py:95
|
||||
msgid "image"
|
||||
msgstr "afbeelding"
|
||||
|
||||
#: models.py:94
|
||||
#: models.py:96
|
||||
msgid "video"
|
||||
msgstr "video"
|
||||
|
||||
#: models.py:94
|
||||
#: models.py:96
|
||||
msgid "Paste a YouTube, Vimeo, or SoundCloud link"
|
||||
msgstr "Plak hier een YouTube, Vimeo of SoundCloud link"
|
||||
|
||||
#: models.py:95
|
||||
#: models.py:97
|
||||
msgid "link"
|
||||
msgstr ""
|
||||
msgstr "link"
|
||||
|
||||
#: models.py:102
|
||||
#: models.py:107
|
||||
msgid "New section"
|
||||
msgstr "Nieuwe sectie"
|
||||
|
||||
#: models.py:104
|
||||
#: models.py:109
|
||||
msgid "Untitled"
|
||||
msgstr "Geen titel"
|
||||
|
||||
#: models.py:111
|
||||
#: models.py:116
|
||||
msgid "sections"
|
||||
msgstr "secties"
|
||||
|
||||
#: templates/cms/base.html:33
|
||||
msgid "new page"
|
||||
msgstr "nieuwe pagina"
|
||||
|
||||
#: templates/cms/edit.html:4
|
||||
msgid "Edit"
|
||||
msgstr "Bewerk"
|
||||
|
||||
#: templates/cms/edit.html:20
|
||||
#: templates/cms/edit.html:13
|
||||
msgid "Please correct the error(s) below and save again"
|
||||
msgstr "Herstel a.u.b. de fout(en) hieronder en sla nogmaals op"
|
||||
|
||||
#: templates/registration/login.html:14 templates/registration/login.html:18
|
||||
msgid "Log in"
|
||||
msgstr "Inloggen"
|
||||
|
||||
#: views.py:191
|
||||
msgid "You can’t save a new page without adding any sections!"
|
||||
msgstr "Voeg minstens één sectie toe!"
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static cms %}
|
||||
{% load cms %}
|
||||
|
||||
{% block title %}{{block.super}} - {{page.title}}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% for section in sections %}
|
||||
<div id="{{section.title|slugify}}"></div>
|
||||
{% include_section section %}
|
||||
{% endfor %}
|
||||
|
||||
{% if perms.cms_page.change %}
|
||||
<div class="edit">
|
||||
<a href="{% if page.slug %}{% url 'cms:updatepage' page.slug %}{% else %}{% url 'cms:updatepage' %}{% endif %}"><img src="{% static 'cms/edit.png' %}"></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% editpage '<img src="/static/cms/edit.png">' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -25,13 +25,30 @@ def eval(context, expr):
|
|||
return mark_safe(md(result, extensions=MARKDOWN_EXTENSIONS))
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def edit(context):
|
||||
def editsection(context, inner):
|
||||
'''Renders a simple link to edit the current section'''
|
||||
if context['request'].user.has_perms('cms_section_change'):
|
||||
slug = context['section'].page.slug
|
||||
number = context['section'].number
|
||||
url = reverse('cms:updatesection', args=[slug, number]) if slug else reverse('cms:updatesection', args=[number])
|
||||
return mark_safe(f'<a class="edit" href="{url}">{_("edit")}</a>')
|
||||
section = context['section']
|
||||
user = context['request'].user
|
||||
app_label = section._meta.app_label
|
||||
model_name = section._meta.model_name
|
||||
if user.has_perms(f'{app_label}_{model_name}_change'):
|
||||
slug = section.page.slug
|
||||
number = section.number
|
||||
url = reverse('cms:updatesection', args=[slug, number]) if slug else reverse('cms:updatesection', args=[number])
|
||||
return mark_safe(f'<a class="edit section" href="{url}">{inner}</a>')
|
||||
return ''
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def editpage(context, inner):
|
||||
'''Renders a simple link to edit the current page'''
|
||||
page = context['page']
|
||||
user = context['request'].user
|
||||
app_label = page._meta.app_label
|
||||
model_name = page._meta.model_name
|
||||
if user.has_perms(f'{app_label}_{model_name}_change'):
|
||||
slug = page.slug
|
||||
url = reverse('cms:updatepage', args=[slug]) if slug else reverse('cms:updatepage')
|
||||
return mark_safe(f'<a class="edit page" href="{url}">{inner}</a>')
|
||||
return ''
|
||||
|
||||
@register.tag('include_section')
|
||||
|
|
|
@ -48,6 +48,7 @@ if not DEBUG:
|
|||
INSTALLED_APPS += ['django.contrib.staticfiles']
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.cache.UpdateCacheMiddleware',
|
||||
'cms.middleware.SassMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
|
@ -56,6 +57,7 @@ MIDDLEWARE = [
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.cache.FetchFromCacheMiddleware',
|
||||
]
|
||||
|
||||
TEMPLATES = [
|
||||
|
|
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
|
Ładowanie…
Reference in New Issue