@@ -1,3 +1,5 @@ | |||
from django.contrib import admin | |||
from .models import Post | |||
admin.site.register(Post) | |||
# Register your models here. |
@@ -0,0 +1,20 @@ | |||
# Generated by Django 2.0.6 on 2018-07-15 12:30 | |||
from django.db import migrations | |||
import taggit.managers | |||
class Migration(migrations.Migration): | |||
dependencies = [ | |||
('taggit', '0002_auto_20150616_2121'), | |||
('application', '0001_initial'), | |||
] | |||
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'), | |||
), | |||
] |
@@ -6,7 +6,7 @@ | |||
<meta charset="UTF-8"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |||
<title> {% block title %}Seitenname{% endblock %}</title> | |||
<link href="{% static 'css/mysite.css' %}" rel="stylesheet"> | |||
<link href="{% static 'css/application.css' %}" rel="stylesheet"> | |||
<link href="{% static 'bootstrap/css/bootstrap.css' %}" rel="stylesheet"> | |||
</head> | |||
@@ -76,8 +76,13 @@ | |||
</div> | |||
</nav> | |||
{% block content %} {% endblock %} | |||
<div class="content container"> | |||
<div class="row"> | |||
<div class="col-md-8"> | |||
{% block content %} {% endblock %} | |||
</div> | |||
</div> | |||
</div> | |||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |||
<script src="{% static 'bootstrap/js/bootstrap.bundle.js' %}"></script> | |||
</body> |
@@ -35,13 +35,13 @@ def navlogin(request): | |||
context = {'error': error} | |||
return render(request, 'index.html', context) | |||
@login_required | |||
def post_list(request): | |||
posts = Post.objects.filter( | |||
published_date__lte=timezone.now()).order_by('published_date') | |||
return render(request, 'post_list.html', {'posts': posts}) | |||
@login_required | |||
def post_detail(request, pk): | |||
post = get_object_or_404(Post, pk=pk) | |||
return render(request, 'post_detail.html', {'post': post}) |
@@ -43,8 +43,8 @@ INSTALLED_APPS = [ | |||
'django.contrib.sessions', | |||
'django.contrib.messages', | |||
'django.contrib.staticfiles', | |||
'taggit', | |||
'application', | |||
'taggit', | |||
] | |||
MIDDLEWARE = [ |
@@ -23,8 +23,8 @@ import application.views | |||
urlpatterns = [ | |||
url(r'^$', TemplateView.as_view(template_name="index.html")), | |||
url(r'^admin/', admin.site.urls), | |||
url(r'^navlogin/', application.views.navlogin, name='navlogin'), | |||
url(r'^accounts/', include('django.contrib.auth.urls')), | |||
url(r'', include('application.urls')) | |||
] |