mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-19 15:33:45 +02:00
better forms
This commit is contained in:
parent
6b69a90ed0
commit
917e15ee0b
11 changed files with 111 additions and 9 deletions
|
@ -35,6 +35,7 @@ INSTALLED_APPS = [
|
|||
'simple_history',
|
||||
'debug_toolbar',
|
||||
'rest_framework',
|
||||
'bootstrap4'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -118,9 +119,9 @@ STATICFILES_DIRS = [
|
|||
os.path.join(BASE_DIR, 'node_modules', 'popper.js', 'dist'),
|
||||
os.path.join(BASE_DIR, 'node_modules', '@trevoreyre'),
|
||||
os.path.join(BASE_DIR, 'node_modules', '@yaireo', 'tagify', 'dist'),
|
||||
os.path.join(BASE_DIR, 'node_modules', 'codemirror')
|
||||
]
|
||||
|
||||
|
||||
INTERNAL_IPS = [
|
||||
'127.0.0.1',
|
||||
]
|
||||
|
|
23
acros/migrations/0025_auto_20200601_1821.py
Normal file
23
acros/migrations/0025_auto_20200601_1821.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.6 on 2020-06-01 18:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('acros', '0024_auto_20200531_1838'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='historicalweblink',
|
||||
name='title',
|
||||
field=models.CharField(blank=True, max_length=500),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='weblink',
|
||||
name='title',
|
||||
field=models.CharField(blank=True, max_length=500),
|
||||
),
|
||||
]
|
|
@ -1,10 +1,21 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="post">{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Update">
|
||||
</form>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<input type="submit" value="Update">
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
<script src="{% static "lib/codemirror.js" %}"></script>
|
||||
<link rel="stylesheet" href="{% static "lib/codemirror.css" %}">
|
||||
<script src="{% static "mode/markdown/markdown.js" %}"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,7 +6,7 @@ def md_to_html(md: str) -> str:
|
|||
md,
|
||||
output_format="html5",
|
||||
extensions=[
|
||||
"nl2br"
|
||||
"nl2br",
|
||||
]
|
||||
)
|
||||
return html
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"@trevoreyre/autocomplete-js": "^2.1.1",
|
||||
"@yaireo/tagify": "^3.9.3",
|
||||
"bootstrap": "^4.5.0",
|
||||
"codemirror": "^5.54.0",
|
||||
"jquery": "^3.5.1",
|
||||
"popper.js": "^1.16.1"
|
||||
}
|
||||
|
|
22
poetry.lock
generated
22
poetry.lock
generated
|
@ -147,6 +147,22 @@ version = ">=16.1.0"
|
|||
argon2 = ["argon2-cffi (>=16.1.0)"]
|
||||
bcrypt = ["bcrypt"]
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Bootstrap support for Django projects"
|
||||
name = "django-bootstrap4"
|
||||
optional = false
|
||||
python-versions = ">=3.6,<4.0"
|
||||
version = "2.0.0"
|
||||
|
||||
[package.dependencies]
|
||||
beautifulsoup4 = ">=4.9.1,<5.0.0"
|
||||
django = ">=2.2,<4.0"
|
||||
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=1.5.0,<2.0.0"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "A configurable set of panels that display various debug information about the current request/response."
|
||||
|
@ -396,7 +412,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
|
|||
testing = ["jaraco.itertools", "func-timeout"]
|
||||
|
||||
[metadata]
|
||||
content-hash = "58d0f8a0b59df62efefb3ee5688f52976722eef1851d152e03f28dcde9cc4686"
|
||||
content-hash = "663794bff5f44b62e356d455b9b1e1f7091c386ab61068589b681f5dd98eac01"
|
||||
python-versions = ">=3.7,<4.0"
|
||||
|
||||
[metadata.files]
|
||||
|
@ -485,6 +501,10 @@ django = [
|
|||
{file = "Django-3.0.6-py3-none-any.whl", hash = "sha256:051ba55d42daa3eeda3944a8e4df2bc96d4c62f94316dea217248a22563c3621"},
|
||||
{file = "Django-3.0.6.tar.gz", hash = "sha256:9aaa6a09678e1b8f0d98a948c56482eac3e3dd2ddbfb8de70a868135ef3b5e01"},
|
||||
]
|
||||
django-bootstrap4 = [
|
||||
{file = "django-bootstrap4-2.0.0.tar.gz", hash = "sha256:2618205322306b1cf3e4e67ec9d42cdf30b2656bf06d2b65d17498b0b2667271"},
|
||||
{file = "django_bootstrap4-2.0.0-py3-none-any.whl", hash = "sha256:ca51246ea4a0bc06f7fa4305cefe7f7700cc09e7da1280f7bea5213470bb673d"},
|
||||
]
|
||||
django-debug-toolbar = [
|
||||
{file = "django-debug-toolbar-2.2.tar.gz", hash = "sha256:eabbefe89881bbe4ca7c980ff102e3c35c8e8ad6eb725041f538988f2f39a943"},
|
||||
{file = "django_debug_toolbar-2.2-py3-none-any.whl", hash = "sha256:ff94725e7aae74b133d0599b9bf89bd4eb8f5d2c964106e61d11750228c8774c"},
|
||||
|
|
|
@ -17,6 +17,7 @@ ads = "^0.12.3"
|
|||
Pillow = "^7.1.2"
|
||||
gunicorn = "^20.0.4"
|
||||
beautifulsoup4 = "^4.9.1"
|
||||
django-bootstrap4 = "^2.0.0"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
bpython = "^0.19"
|
||||
|
|
|
@ -68,4 +68,11 @@ fetch("/api/tag/")
|
|||
|
||||
})
|
||||
|
||||
const myCodeMirror = CodeMirror.fromTextArea(
|
||||
document.getElementById("id_description_md"),
|
||||
{
|
||||
lineWrapping: true,
|
||||
lineNumbers: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ h1.acronym {
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.tags{
|
||||
margin-bottom: 2rem;
|
||||
.tags {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.taglist {
|
||||
|
@ -73,3 +73,34 @@ margin-bottom: 2rem;
|
|||
font-size: 150%;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
/* https://stackoverflow.com/a/27727359/4398037 */
|
||||
.CodeMirror {
|
||||
/* Bootstrap Settings */
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font: inherit;
|
||||
display: block;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
line-height: 1.42857143;
|
||||
color: #555;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
/* Code Mirror Settings */
|
||||
font-family: monospace, monospace;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-focused {
|
||||
/* Bootstrap Settings */
|
||||
border-color: #66afe9;
|
||||
outline: 0;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{% load bootstrap4 %}
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
@ -18,6 +19,7 @@
|
|||
<body>
|
||||
{# <div class="container {{ referrers is defined ? "edit" }}">#}
|
||||
<div class="container {% block containerclasses %}{% endblock %}">
|
||||
{% bootstrap_messages %}
|
||||
{% if user.is_authenticated %}
|
||||
<div class="accountStatus">
|
||||
Hello {{ user.get_username }}, <a href="{% url 'logout' %}">Log out</a>
|
||||
|
|
|
@ -17,6 +17,11 @@ bootstrap@^4.5.0:
|
|||
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.5.0.tgz#97d9dbcb5a8972f8722c9962483543b907d9b9ec"
|
||||
integrity sha512-Z93QoXvodoVslA+PWNdk23Hze4RBYIkpb5h8I2HY2Tu2h7A0LpAgLcyrhrSUyo2/Oxm2l1fRZPs1e5hnxnliXA==
|
||||
|
||||
codemirror@^5.54.0:
|
||||
version "5.54.0"
|
||||
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.54.0.tgz#82b6adf662b29eeb7b867fe7839d49e25e4a0b38"
|
||||
integrity sha512-Pgf3surv4zvw+KaW3doUU7pGjF0BPU8/sj7eglWJjzni46U/DDW8pu3nZY0QgQKUcICDXRkq8jZmq0y6KhxM3Q==
|
||||
|
||||
jquery@^3.5.1:
|
||||
version "3.5.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
|
||||
|
|
Loading…
Reference in a new issue