Added base templates

master
Laurent 6 years ago
parent 908ae1a139
commit 261279b881
  1. BIN
      news/__pycache__/urls.cpython-37.pyc
  2. BIN
      news/__pycache__/views.cpython-37.pyc
  3. 3
      news/static/news/style.css
  4. 33
      news/templates/base.html
  5. 24
      news/templates/news/createaccount.html
  6. 7
      news/templates/news/index.html
  7. 7
      news/templates/news/post.html
  8. 10
      news/templates/news/submission.html
  9. 8
      news/templates/news/submitted.html
  10. 1
      news/urls.py
  11. 3
      news/views.py

@ -0,0 +1,3 @@
li a {
color: red;
}

@ -0,0 +1,33 @@
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="{% static 'news/style.css' %}">
<title>{% block title %}My amazing site{% endblock %}</title>
</head>
<body>
<h1><a href="{% url 'news:index' %}">Poker CC</a></h1>
<p>
{% if user.is_authenticated %}
<a href="{% url 'news:submission' %}">Submit</a>
{% else %}
<a href="{% url 'news:createaccount' %}">Create account</a>
{% endif %}
</p>
<hr/>
<div id="content">
{% block content %}{% endblock %}
</div>
<hr/>
<footer>
some footer
</footer>
</body>
</html>

@ -0,0 +1,24 @@
{% extends "base.html" %}
{% block title %}My amazing blog{% endblock %}
{% block content %}
<h1>Create account</h1>
<form action="{% url 'news:submit' %}" method="post">
<p>Username</p>
<p>
<input type="text" name="username" value="">
</p>
<p>Password</p>
<p>
<input type="text" name="password1" value="">
<input type="text" name="password2" value="">
</p>
<input type="submit" value="Submit">
</form>
{% endblock content %}

@ -1,5 +1,8 @@
<h1>Poker CC</h1>
{% extends "base.html" %}
{% block title %}My amazing blog{% endblock %}
{% block content %}
{% if latest_post_list %}
<ul>
{% for post in latest_post_list %}
@ -10,4 +13,4 @@
<p>No posts are available.</p>
{% endif %}
<a href="{% url 'news:submission' %}">Submit</a></li>
{% endblock content %}

@ -1,3 +1,8 @@
{% extends "base.html" %}
{% block title %}My amazing blog{% endblock %}
{% block content %}
<a href="{{ post.url }}"><h1>{{ post.title }}</h1></a>
<h3>written by {{ post.author.username }}</h3>
<p>----Body----</p>
@ -20,3 +25,5 @@
<li>{{ comment.body }}</li>
{% endfor %}
</ul>
{% endblock content %}

@ -1,3 +1,9 @@
{% extends "base.html" %}
{% block title %}My amazing blog{% endblock %}
{% block content %}
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{% if user.is_authenticated %}
@ -28,7 +34,7 @@
</p>
<p>
<input type="radio" name="state" id="1" value="1">
<input type="radio" name="state" id="1" value="1" checked="true">
<label for="choice1">Publish</label>
<input type="radio" name="state" id="2" value="2">
<label for="choice2">Draft</label>
@ -44,3 +50,5 @@
{% else %}
<a href="../admin/login">Please log in</a>
{% endif %}
{% endblock content %}

@ -1,3 +1,11 @@
{% extends "base.html" %}
{% block title %}My amazing blog{% endblock %}
{% block content %}
<p>Thanks :)</p>
<p><a href="{% url 'news:index' %}">Home</a></p>
{% endblock content %}

@ -10,5 +10,6 @@ urlpatterns = [
path('submit', views.submit, name='submit'),
path('<int:post_id>/comment', views.comment, name='comment'),
path('submitted', views.submitted, name='submitted'),
path('createaccount', views.createaccount, name='createaccount'),
]

@ -20,6 +20,9 @@ def post(request, post_id):
def submission(request):
return render(request, 'news/submission.html', {})
def createaccount(request):
return render(request, 'news/createaccount.html', {})
def submit(request):
if 'state' in request.POST:

Loading…
Cancel
Save