Commit ab6a4c72 authored by Sander Høyland's avatar Sander Høyland
Browse files

Basic django-struktur og noen sider

parent 6dadfd65
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (venv)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.8 (venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module> </module>
\ No newline at end of file
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
<title>Home page</title> <title>Home page</title>
</head> </head>
<body> <body>
<h1>Start page of the application</h1> {% for post in posts %}
<h1>{{post.title}}</h1>
<p>By {{post.author}} on {{post.date_posted}}</p>
<p>{{post.content}}</p>
{% endfor %}
</body> </body>
</html> </html>
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
def home(request): def home(request):
return render(request, 'startpage/home.html') context = {
'posts': posts
}
return render(request, 'startpage/home.html', context)
def login(request): def login(request):
return render(request, 'startpage/login.html') return render(request, 'startpage/login.html')
posts = [
{
'author': 'Sander Høyland',
'title': 'Strikkeoppdatering 1',
'content': 'Startet på et nytt pannebånd!',
'date-posted': '10.02.2020'
},
{
'author': 'Sander Høyland',
'title': 'Strikkeoppdatering 2',
'content': 'Ferdig med pannebåndet!',
'date-posted': '18.02.2020'
}
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment