various fixes and improvements

master
Laurent Morvillier 6 years ago
parent 4a196fadd3
commit f60444c231
  1. 2
      news/models.py
  2. 8
      news/static/news/css/app.css
  3. 2
      news/templates/base.html
  4. 15
      news/templates/news/post.html
  5. 37
      news/templates/news/user/password_reset_confirm.html
  6. 3
      news/templates/news/user/password_reset_html_email.html
  7. 1
      news/templates/news/user/password_reset_subject.txt
  8. 7
      news/urls.py
  9. 9
      pokercc/settings.py

@ -30,7 +30,7 @@ class Post(models.Model):
return string return string
def top_comments(self): def top_comments(self):
return self.comment_set.order_by('-voters').all()[:1] return self.comment_set.filter(Q(parent_comment=None)).order_by('-voters').all()[:1]
def flat_comments(self, user): def flat_comments(self, user):
flat = [] flat = []

@ -180,14 +180,14 @@ a h1 {
.imgcontainer { .imgcontainer {
position: relative; position: relative;
color: white; color: white;
border-bottom: 10px solid #111; /* border-bottom: 0px solid #111; */
border-top: 10px solid #111; border-top: 20px solid #111;
} }
@media print, screen and (min-width: 40em) { @media print, screen and (min-width: 40em) {
.imgcontainer { .imgcontainer {
width: 600px; width: 600px;
border-bottom: 10px solid #111; /* border-bottom: 10px solid #111; */
border-top: 10px solid #111; border-top: 20px solid #111;
} }
} }

@ -61,7 +61,7 @@
<footer> <footer>
<a href="{% url 'news:contact' %}">Contact</a> <a href="{% url 'news:contact' %}">Contact</a>
<p>Copyright © 2019 Stax River</p> <p>Copyright © 2019 Poker Rumble</p>
</footer> </footer>

@ -36,6 +36,7 @@
{% endif %} {% endif %}
<br/> <br/>
{% if user.is_authenticated %}
<form action="{% url 'news:comment' post.id %}" method="post"> <form action="{% url 'news:comment' post.id %}" method="post">
{% csrf_token %} {% csrf_token %}
<p>Add comment</p> <p>Add comment</p>
@ -44,6 +45,11 @@
</p> </p>
<button class="primary_button" type="submit">Submit</button> <button class="primary_button" type="submit">Submit</button>
</form> </form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to comment the post
</p>
{% endif %}
<script type="text/javascript"> <script type="text/javascript">
function myFunction(divID) { function myFunction(divID) {
@ -69,7 +75,7 @@
{{ comment.body }} {{ comment.body }}
<div> <div>
{% if comment.upvoted == False %} {% if comment.upvoted == False and user.is_authenticated %}
<form action="{% url 'news:upvote' comment.id %}" method="post" class="inline"> <form action="{% url 'news:upvote' comment.id %}" method="post" class="inline">
{% csrf_token %} {% csrf_token %}
<button class="primary_button" type="submit">+1</button> <button class="primary_button" type="submit">+1</button>
@ -86,11 +92,18 @@
<button class="secondary_button inline" onclick="myFunction('{{ comment.id }}')">reply</button> <button class="secondary_button inline" onclick="myFunction('{{ comment.id }}')">reply</button>
<div id="div_{{ comment.id }}" class="inline reply_form" style="display:none"> <div id="div_{{ comment.id }}" class="inline reply_form" style="display:none">
{% if user.is_authenticated %}
<form action="{% url 'news:comment_with_parent' post.id comment.id %}" method="post"> <form action="{% url 'news:comment_with_parent' post.id comment.id %}" method="post">
{% csrf_token %} {% csrf_token %}
<textarea id="text_{{ comment.id}}" name="body" rows="3" cols="50"></textarea> <textarea id="text_{{ comment.id}}" name="body" rows="3" cols="50"></textarea>
<button id="sub_{{ comment.id}}" class="primary_button" type="submit">Submit</button> <button id="sub_{{ comment.id}}" class="primary_button" type="submit">Submit</button>
</form> </form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to reply
</p>
{% endif %}
</div> </div>
</div> </div>

@ -1,17 +1,34 @@
{% extends 'base.html' %}
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block content_title %}<h1>{{ title }}</h1>{% endblock %}
{% block content %} {% block content %}
{% if validlink %} {% if validlink %}
<h3>Change password</h3>
<form method="post"> <p>Please enter your new password twice so we can verify you typed it in correctly.</p>
{% csrf_token %}
{{ form.as_p }} <form method="post">{% csrf_token %}
<button class="primary_button" type="submit">Change password</button> <fieldset class="module aligned">
<div class="form-row field-password1">
{{ form.new_password1.errors }}
<label for="id_new_password1">New password:</label>
{{ form.new_password1 }}
</div>
<div class="form-row field-password2">
{{ form.new_password2.errors }}
<label for="id_new_password2">Confirm password:</label>
{{ form.new_password2 }}
</div>
<input type="submit" value="Change my password">
</fieldset>
</form> </form>
{% else %} {% else %}
<p>
The password reset link was invalid, possibly because it has already been used. <p>The password reset link was invalid, possibly because it has already been used. Please request a new password reset.</p>
Please request a new password reset.
</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

@ -1,2 +1,3 @@
Someone asked for password reset for email {{ email }}. Follow the link below: Someone asked for password reset for email {{ email }}.
Follow the link below:
{{ protocol}}://{{ domain }}{% url 'news:password_reset_confirm' uidb64=uid token=token %} {{ protocol}}://{{ domain }}{% url 'news:password_reset_confirm' uidb64=uid token=token %}

@ -27,11 +27,12 @@ urlpatterns = [
template_name='news/user/password_reset_form.html', template_name='news/user/password_reset_form.html',
email_template_name='news/user/password_reset_email.html', email_template_name='news/user/password_reset_email.html',
html_email_template_name='news/user/password_reset_html_email.html', html_email_template_name='news/user/password_reset_html_email.html',
subject_template_name='news/user/password_reset_subject.txt',
success_url='../password-reset/done' success_url='../password-reset/done'
), name='password_reset'), ), name='password_reset'),
path('password-reset/done', auth_views.PasswordResetDoneView.as_view(template_name='news/user/password_reset_done.html'), name='password_reset_done'), path('password-reset/done', auth_views.PasswordResetDoneView.as_view(template_name='news/user/password_reset_done.html'), name='password_reset_done'),
path('reset/<uidb64>/<token>', auth_views.PasswordResetConfirmView.as_view( path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(
template_name='news/user/password_reset_confirm.html', template_name='news/user/password_reset_confirm.html',
success_url='../password-change/done'), name='password_reset_confirm'), success_url='password-change/done'), name='password_reset_confirm'),
path('password-change/done', auth_views.PasswordResetCompleteView.as_view(template_name='news/user/password_reset_complete.html'), name='password_change_done'), path('reset/Mg/set-password/password-change/done', auth_views.PasswordResetCompleteView.as_view(template_name='news/user/password_reset_complete.html'), name='password_change_done'),
] ]

@ -29,7 +29,14 @@ DEBUG = True
ALLOWED_HOSTS = ['ssh-stax.alwaysdata.net', 'www.pokerrumble.net'] ALLOWED_HOSTS = ['ssh-stax.alwaysdata.net', 'www.pokerrumble.net']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' #EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'smtp-stax.alwaysdata.net'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'automatic@pokerrumble.net'
EMAIL_HOST_PASSWORD = 'StaxKikoo12'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'Poker Rumble <automatic@pokerrumble.net>'
# Application definition # Application definition

Loading…
Cancel
Save