diff --git a/config/settings/base.py b/config/settings/base.py index 02a2eb7..8dabdb0 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -73,6 +73,7 @@ THIRD_PARTY_APPS = [ LOCAL_APPS = [ "schickmacher.users.apps.UsersConfig", + "schickmacher.renderer.apps.RendererConfig", # Your stuff: custom apps go here ] # https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps @@ -246,7 +247,7 @@ LOGGING = { # django-allauth # ------------------------------------------------------------------------------ -ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True) +ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", False) # https://django-allauth.readthedocs.io/en/latest/configuration.html ACCOUNT_AUTHENTICATION_METHOD = "username" # https://django-allauth.readthedocs.io/en/latest/configuration.html diff --git a/config/urls.py b/config/urls.py index fe946e0..d4f14d4 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,12 +1,12 @@ from django.conf import settings -from django.urls import include, path +from django.urls import include, path, reverse_lazy from django.conf.urls.static import static from django.contrib import admin -from django.views.generic import TemplateView +from django.views.generic import TemplateView, RedirectView from django.views import defaults as default_views urlpatterns = [ - path("", TemplateView.as_view(template_name="pages/home.html"), name="home"), + path("", RedirectView.as_view(url=reverse_lazy('renderer:form')), name="home"), path( "about/", TemplateView.as_view(template_name="pages/about.html"), name="about" ), @@ -14,6 +14,7 @@ urlpatterns = [ path(settings.ADMIN_URL, admin.site.urls), # User management path("users/", include("schickmacher.users.urls", namespace="users")), + path("renderer/", include("schickmacher.renderer.urls", namespace="renderer")), path("accounts/", include("allauth.urls")), # Your stuff: custom urls includes go here ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/locale/README.rst b/locale/README.rst old mode 100644 new mode 100755 diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po new file mode 100755 index 0000000..6638012 --- /dev/null +++ b/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,305 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-09-05 08:52+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: schickmacher/renderer/apps.py:7 +msgid "Renderer" +msgstr "Renderer" + +#: schickmacher/renderer/forms.py:6 +msgid "Date" +msgstr "Datum" + +#: schickmacher/templates/account/account_inactive.html:5 +#: schickmacher/templates/account/account_inactive.html:8 +msgid "Account Inactive" +msgstr "Account Inaktiv" + +#: schickmacher/templates/account/account_inactive.html:10 +msgid "This account is inactive." +msgstr "Dieser Account ist deaktiviert" + +#: schickmacher/templates/account/email.html:7 +msgid "Account" +msgstr "Account" + +#: schickmacher/templates/account/email.html:10 +msgid "E-mail Addresses" +msgstr "E-Mail Adressen" + +#: schickmacher/templates/account/email.html:13 +msgid "The following e-mail addresses are associated with your account:" +msgstr "Die folgenden E-Mail Adressen gehören zu ihrem Account" + +#: schickmacher/templates/account/email.html:27 +msgid "Verified" +msgstr "Verifiziert" + +#: schickmacher/templates/account/email.html:29 +msgid "Unverified" +msgstr "Nicht verifiziert" + +#: schickmacher/templates/account/email.html:31 +msgid "Primary" +msgstr "Primär" + +#: schickmacher/templates/account/email.html:37 +msgid "Make Primary" +msgstr "Als primär festlegen" + +#: schickmacher/templates/account/email.html:38 +msgid "Re-send Verification" +msgstr "Verifikation erneut versenden" + +#: schickmacher/templates/account/email.html:39 +msgid "Remove" +msgstr "Entfernen" + +#: schickmacher/templates/account/email.html:46 +msgid "Warning:" +msgstr "Warnung:" + +#: schickmacher/templates/account/email.html:46 +msgid "" +"You currently do not have any e-mail address set up. You should really add " +"an e-mail address so you can receive notifications, reset your password, etc." +msgstr "" +"Sie haben zurzeit keine E-Mail Adressen eingerichtet. Sie sollten eine E-Mail " +"Adresse einrichten um Benachrichtigungen zu erhalten, ihr Passwort zurückzusetpen, etc." + +#: schickmacher/templates/account/email.html:51 +msgid "Add E-mail Address" +msgstr "E-Mail Adresse hinzufügen" + +#: schickmacher/templates/account/email.html:56 +msgid "Add E-mail" +msgstr "E-Mail hinzufügen" + +#: schickmacher/templates/account/email.html:66 +msgid "Do you really want to remove the selected e-mail address?" +msgstr "Möchten sie die E-Mail Adresse wirklich entfernen?" + +#: schickmacher/templates/account/email_confirm.html:6 +#: schickmacher/templates/account/email_confirm.html:10 +msgid "Confirm E-mail Address" +msgstr "E-Mail Adresse bestätigen" + +#: schickmacher/templates/account/email_confirm.html:16 +#, python-format +msgid "" +"Please confirm that %(email)s is an e-mail " +"address for user %(user_display)s." +msgstr "" + +#: schickmacher/templates/account/email_confirm.html:20 +msgid "Confirm" +msgstr "" + +#: schickmacher/templates/account/email_confirm.html:27 +#, python-format +msgid "" +"This e-mail confirmation link expired or is invalid. Please issue a new e-mail confirmation request." +msgstr "" + +#: schickmacher/templates/account/login.html:7 +#: schickmacher/templates/account/login.html:11 +#: schickmacher/templates/account/login.html:44 +#: schickmacher/templates/base.html:68 +msgid "Sign In" +msgstr "" + +#: schickmacher/templates/account/login.html:16 +#, python-format +msgid "" +"Please sign in with one\n" +"of your existing third party accounts. Or, sign " +"up\n" +"for a %(site_name)s account and sign in below:" +msgstr "" + +#: schickmacher/templates/account/login.html:26 +msgid "or" +msgstr "" + +#: schickmacher/templates/account/login.html:33 +#, python-format +msgid "" +"If you have not created an account yet, then please\n" +"sign up first." +msgstr "" + +#: schickmacher/templates/account/login.html:43 +msgid "Forgot Password?" +msgstr "" + +#: schickmacher/templates/account/logout.html:5 +#: schickmacher/templates/account/logout.html:8 +#: schickmacher/templates/account/logout.html:17 +#: schickmacher/templates/base.html:59 +msgid "Sign Out" +msgstr "" + +#: schickmacher/templates/account/logout.html:10 +msgid "Are you sure you want to sign out?" +msgstr "" + +#: schickmacher/templates/account/password_change.html:6 +#: schickmacher/templates/account/password_change.html:9 +#: schickmacher/templates/account/password_change.html:14 +#: schickmacher/templates/account/password_reset_from_key.html:5 +#: schickmacher/templates/account/password_reset_from_key.html:8 +#: schickmacher/templates/account/password_reset_from_key_done.html:4 +#: schickmacher/templates/account/password_reset_from_key_done.html:7 +msgid "Change Password" +msgstr "" + +#: schickmacher/templates/account/password_reset.html:7 +#: schickmacher/templates/account/password_reset.html:11 +#: schickmacher/templates/account/password_reset_done.html:6 +#: schickmacher/templates/account/password_reset_done.html:9 +msgid "Password Reset" +msgstr "" + +#: schickmacher/templates/account/password_reset.html:16 +msgid "" +"Forgotten your password? Enter your e-mail address below, and we'll send you " +"an e-mail allowing you to reset it." +msgstr "" + +#: schickmacher/templates/account/password_reset.html:21 +msgid "Reset My Password" +msgstr "" + +#: schickmacher/templates/account/password_reset.html:24 +msgid "Please contact us if you have any trouble resetting your password." +msgstr "" + +#: schickmacher/templates/account/password_reset_done.html:15 +msgid "" +"We have sent you an e-mail. Please contact us if you do not receive it " +"within a few minutes." +msgstr "" + +#: schickmacher/templates/account/password_reset_from_key.html:8 +msgid "Bad Token" +msgstr "" + +#: schickmacher/templates/account/password_reset_from_key.html:12 +#, python-format +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" + +#: schickmacher/templates/account/password_reset_from_key.html:18 +msgid "change password" +msgstr "" + +#: schickmacher/templates/account/password_reset_from_key.html:21 +#: schickmacher/templates/account/password_reset_from_key_done.html:8 +msgid "Your password is now changed." +msgstr "" + +#: schickmacher/templates/account/password_set.html:6 +#: schickmacher/templates/account/password_set.html:9 +#: schickmacher/templates/account/password_set.html:14 +msgid "Set Password" +msgstr "" + +#: schickmacher/templates/account/signup.html:6 +msgid "Signup" +msgstr "" + +#: schickmacher/templates/account/signup.html:9 +#: schickmacher/templates/account/signup.html:19 +#: schickmacher/templates/base.html:64 +msgid "Sign Up" +msgstr "" + +#: schickmacher/templates/account/signup.html:11 +#, python-format +msgid "" +"Already have an account? Then please sign in." +msgstr "" + +#: schickmacher/templates/account/signup_closed.html:5 +#: schickmacher/templates/account/signup_closed.html:8 +msgid "Sign Up Closed" +msgstr "" + +#: schickmacher/templates/account/signup_closed.html:10 +msgid "We are sorry, but the sign up is currently closed." +msgstr "" + +#: schickmacher/templates/account/verification_sent.html:5 +#: schickmacher/templates/account/verification_sent.html:8 +#: schickmacher/templates/account/verified_email_required.html:5 +#: schickmacher/templates/account/verified_email_required.html:8 +msgid "Verify Your E-mail Address" +msgstr "" + +#: schickmacher/templates/account/verification_sent.html:10 +msgid "" +"We have sent an e-mail to you for verification. Follow the link provided to " +"finalize the signup process. Please contact us if you do not receive it " +"within a few minutes." +msgstr "" + +#: schickmacher/templates/account/verified_email_required.html:12 +msgid "" +"This part of the site requires us to verify that\n" +"you are who you claim to be. For this purpose, we require that you\n" +"verify ownership of your e-mail address. " +msgstr "" + +#: schickmacher/templates/account/verified_email_required.html:16 +msgid "" +"We have sent an e-mail to you for\n" +"verification. Please click on the link inside this e-mail. Please\n" +"contact us if you do not receive it within a few minutes." +msgstr "" + +#: schickmacher/templates/account/verified_email_required.html:20 +#, python-format +msgid "" +"Note: you can still change your e-" +"mail address." +msgstr "" + +#: schickmacher/templates/base.html:55 +msgid "My Profile" +msgstr "" + +#: schickmacher/users/apps.py:7 +msgid "Users" +msgstr "" + +#: schickmacher/users/forms.py:16 +msgid "This username has already been taken." +msgstr "" + +#: schickmacher/users/models.py:11 +msgid "Name of User" +msgstr "" + +#: schickmacher/users/views.py:34 +msgid "Infos successfully updated" +msgstr "" diff --git a/schickmacher/renderer/__init__.py b/schickmacher/renderer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/schickmacher/renderer/apps.py b/schickmacher/renderer/apps.py new file mode 100644 index 0000000..f7f6d7e --- /dev/null +++ b/schickmacher/renderer/apps.py @@ -0,0 +1,13 @@ +from django.apps import AppConfig +from django.utils.translation import gettext_lazy as _ + + +class RendererConfig(AppConfig): + name = "schickmacher.renderer" + verbose_name = _("Renderer") + + def ready(self): + try: + import schickmacher.renderer.signals # noqa F401 + except ImportError: + pass diff --git a/schickmacher/renderer/forms.py b/schickmacher/renderer/forms.py new file mode 100644 index 0000000..2af7cb8 --- /dev/null +++ b/schickmacher/renderer/forms.py @@ -0,0 +1,15 @@ +from django.utils.translation import ugettext_lazy as _ +from django import forms +from django.utils import timezone + + +class RendererForm(forms.Form): + date = forms.DateField(label=_('Date'), + initial=lambda: timezone.now().strftime('%Y-%m-%d'), + widget=forms.TextInput( + attrs={'type': 'date'} + )) + render_content = forms.CharField( + label=_('Content'), widget=forms.Textarea, max_length=None, + required=False, initial="" + ) diff --git a/schickmacher/renderer/tests/test_forms.py b/schickmacher/renderer/tests/test_forms.py new file mode 100644 index 0000000..199b91a --- /dev/null +++ b/schickmacher/renderer/tests/test_forms.py @@ -0,0 +1,16 @@ +from datetime import datetime + +import pytest +from django.utils import timezone + +from schickmacher.renderer.forms import RendererForm + + +class TestRendererForm: + def test_form_accepts_content(self): + form = RendererForm({ + "date": timezone.now(), + "render_content": "Example **content**" + }) + assert form.is_valid() + diff --git a/schickmacher/renderer/tests/test_urls.py b/schickmacher/renderer/tests/test_urls.py new file mode 100644 index 0000000..3588ae9 --- /dev/null +++ b/schickmacher/renderer/tests/test_urls.py @@ -0,0 +1,8 @@ +import pytest + +from django.urls import reverse, resolve + + +def test_form(): + assert reverse('renderer:form') == '/renderer/' + assert resolve('/renderer/').view_name == 'renderer:form' diff --git a/schickmacher/renderer/tests/test_views.py b/schickmacher/renderer/tests/test_views.py new file mode 100644 index 0000000..d19f335 --- /dev/null +++ b/schickmacher/renderer/tests/test_views.py @@ -0,0 +1,15 @@ +import pytest + +from django.test import Client +from django.utils import timezone + +pytestmark = pytest.mark.django_db + + +class TestRendererFormView: + + def test_get_empty_form(self, client: Client): + response = client.get('/renderer/') + assert response.status_code == 200 + assert response.context['form']['date'].value() \ + == timezone.now().strftime('%Y-%m-%d') diff --git a/schickmacher/renderer/urls.py b/schickmacher/renderer/urls.py new file mode 100644 index 0000000..62b4517 --- /dev/null +++ b/schickmacher/renderer/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from schickmacher.renderer.views import form_view + +app_name = 'renderer' +urlpatterns = [ + path("", view=form_view, name="form") +] diff --git a/schickmacher/renderer/views.py b/schickmacher/renderer/views.py new file mode 100644 index 0000000..0c0c38a --- /dev/null +++ b/schickmacher/renderer/views.py @@ -0,0 +1,9 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.shortcuts import render + +from schickmacher.renderer.forms import RendererForm + + +def form_view(request: WSGIRequest): + ctx = {"form": RendererForm()} + return render(request, 'renderer/render_form.html', ctx) diff --git a/schickmacher/templates/base.html b/schickmacher/templates/base.html index 0a445fe..4a893e6 100644 --- a/schickmacher/templates/base.html +++ b/schickmacher/templates/base.html @@ -16,17 +16,17 @@ {% block css %} - + - + {% compress css %} - + - + {% endcompress %} {% endblock %} @@ -46,6 +46,9 @@ + @@ -94,14 +97,14 @@ ================================================== --> {% block javascript %} - + - + {% compress js %} @@ -111,4 +114,4 @@ {% endblock javascript %} - + diff --git a/schickmacher/templates/renderer/render_form.html b/schickmacher/templates/renderer/render_form.html new file mode 100644 index 0000000..a309d31 --- /dev/null +++ b/schickmacher/templates/renderer/render_form.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% load i18n %} +{% load crispy_forms_tags %} + +{% block title %}{% trans "Renderer" %}{% endblock %} + + +{% block content %} +

{% trans "Renderer" %}

+
+ {% csrf_token %} + {{ form|crispy }} +
+
+ +
+
+
+{% endblock %}