reinstalled django because of problems with the migrations and installed taggit-template2 to list tags
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
# Generated by Django 2.0.6 on 2018-08-15 16:15
|
||||
# Generated by Django 2.1 on 2018-08-18 15:34
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import taggit.managers
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@@ -13,7 +12,6 @@ class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('taggit', '0002_auto_20150616_2121'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@@ -21,8 +19,6 @@ class Migration(migrations.Migration):
|
||||
name='CustomUser',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('mytags', taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
@@ -34,7 +30,6 @@ class Migration(migrations.Migration):
|
||||
('created_date', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('published_date', models.DateTimeField(blank=True, null=True)),
|
||||
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
('tags', taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Generated by Django 2.1 on 2018-08-18 15:34
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import taggit.managers
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('taggit', '0001_initial'),
|
||||
('application', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='post',
|
||||
name='tags',
|
||||
field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customuser',
|
||||
name='mytags',
|
||||
field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customuser',
|
||||
name='user',
|
||||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
]
|
||||
+2280
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,8 @@
|
||||
<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>
|
||||
@@ -90,6 +92,7 @@
|
||||
</div>
|
||||
<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 'bootstrap/js/bootstrap.bundle.js' %}"></script>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %} {% block content %} {% for post in posts %}
|
||||
{% extends 'base.html' %} {% block content %} {% for post in posts %} {% load taggit_templatetags2_tags %}
|
||||
<div class="post">
|
||||
<div class="date">
|
||||
{{ post.published_date }}
|
||||
@@ -8,7 +8,7 @@
|
||||
</h1>
|
||||
<p>{{ post.text|linebreaks }}</p>
|
||||
<p>
|
||||
{% for tag in post.tags.all %}
|
||||
{% for tag in post.tags.all %}
|
||||
<a href="">{{ tag.name }}, </a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
@@ -17,4 +17,14 @@
|
||||
</p>
|
||||
|
||||
</div>
|
||||
{% endfor %} {% endblock %}
|
||||
{% endfor %}
|
||||
{% get_tagcloud as tags for 'application' %}
|
||||
<div id="tag-cloud">
|
||||
<ul>
|
||||
{% for tag in tags %}
|
||||
<li>{{tag}} ({{tag.num_times}})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user