From: Neil Smith Date: Wed, 5 Oct 2016 09:25:07 +0000 (+0100) Subject: Done first view X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=b124d1bef876b3cc08fe7a53999d7cb8bb896e62;p=django-girls.git Done first view --- diff --git a/.gitignore b/.gitignore index 42365e0..f6cc5da 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,7 @@ nosetests.xml # Virtual environment djangogirls + +# Django static files +/static +.DS_Store diff --git a/blog/templates/blog/post_list.html b/blog/templates/blog/post_list.html new file mode 100644 index 0000000..aa9d1d5 --- /dev/null +++ b/blog/templates/blog/post_list.html @@ -0,0 +1,23 @@ + + + + Neil's blog + + + +
+

Django Girls Blog

+
+
+

published: 14.06.2014, 12:14

+

My first post

+

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut rmentum mass a justo sit amet risus.

+
+
+

published: 14.06.2014, 12:14

+

My second post

+

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut f.

+
+ + + \ No newline at end of file diff --git a/blog/urls.py b/blog/urls.py new file mode 100644 index 0000000..eecfb5f --- /dev/null +++ b/blog/urls.py @@ -0,0 +1,6 @@ +from django.conf.urls import url +from . import views + +urlpatterns = [ + url(r'^$', views.post_list, name='post_list'), +] \ No newline at end of file diff --git a/blog/views.py b/blog/views.py index 91ea44a..299ca35 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,3 +1,4 @@ from django.shortcuts import render -# Create your views here. +def post_list(request): + return render(request, 'blog/post_list.html', {}) diff --git a/mysite/urls.py b/mysite/urls.py index bc15726..df6b88d 100644 --- a/mysite/urls.py +++ b/mysite/urls.py @@ -13,9 +13,10 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), + url('', include('blog.urls')), ]