added new js file and make the published date editable on webiste

This commit is contained in:
Esther Kleinhenz 2018-08-19 16:24:53 +02:00
parent 2cb1629a81
commit 145fd921d9
6 changed files with 15 additions and 9 deletions

View File

@ -1,9 +1,8 @@
from django import forms
from .models import Post, CustomUser
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
class PostForm(forms.ModelForm):
published_date = forms.DateField(widget=forms.widgets.DateInput(format="%d. %h %Y, %M:%S"))
class Meta:
model = Post
fields = ('title', 'text')
fields = ('title', 'text', 'published_date', 'tags')

View File

View File

@ -8,8 +8,6 @@
<title> {% block title %}Seitenname{% endblock %}</title>
<link href="{% static 'css/application.css' %}" rel="stylesheet">
<link href="{% static 'bootstrap/css/bootstrap.css' %}" rel="stylesheet">
{% include "taggit_templatetags2/tagcanvas_include_js_static.html" %}
{% include_tagcanvas 'tag-cloud' 'width px' 'height px' 'post_list.html' 'application' %}
</head>
<body>
@ -62,7 +60,8 @@
<li>
<form class="form" role="form" method="post" action="{% url 'login' %}" accept-charset="UTF-8" id="login-nav">
{% csrf_token %} {% if next %}
<input type="hidden" name="next" value="{{ next }}" /> {% endif %}
<input type="hidden" name="next" value="{{ next }}" />
{% endif %}
<div class="form-group">
<label class="sr-only" for="username">Benutzername</label>
<input type="text" class="form-control" id="username" name="username" placeholder="Benutzername" required>
@ -93,6 +92,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="{% static 'bootstrap/js/jquery-1.11.1.js' %} "></script>
<script src="{% static 'bootstrap/jsjquery.tagcanvas.min.js' %} " type="text/javascript"></script>
<script src="{% static 'js/app.js' %}"></script>
<script src="{% static 'bootstrap/js/bootstrap.bundle.js' %}"></script>
</body>

View File

@ -1,4 +1,10 @@
{% extends "base.html" %} {% block content %}
hi
<div id="tag-cloud">
<ul>
{% for tag in tags %}
<li>{{tag}} ({{tag.num_times}})</li>
{% endfor %}
</ul>
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block content %}
<h1>New post</h1>
<form method="POST" class="post-form">{% csrf_token %}
{{ form.as_p }}
{{ form.as_p }}
<button type="submit" class="save btn btn-outline-dark">Save</button>
</form>
{% endblock %}

View File

@ -18,7 +18,8 @@
</div>
{% endfor %}
{% get_tagcloud as tags for 'application' %}
{% include "taggit_templatetags2/tagcanvas_include_js_static.html" %}
<div id="tag-cloud">
<ul>
{% for tag in tags %}