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. 27
      news/templates/news/post.html
  5. 45
      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
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):
flat = []

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

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

@ -36,14 +36,20 @@
{% endif %}
<br/>
<form action="{% url 'news:comment' post.id %}" method="post">
{% csrf_token %}
<p>Add comment</p>
{% if user.is_authenticated %}
<form action="{% url 'news:comment' post.id %}" method="post">
{% csrf_token %}
<p>Add comment</p>
<p>
<textarea name="body" rows="3" cols="50"></textarea>
</p>
<button class="primary_button" type="submit">Submit</button>
</form>
{% else %}
<p>
<textarea name="body" rows="3" cols="50"></textarea>
Please <a href="{% url 'news:signin' %}">login</a> to comment the post
</p>
<button class="primary_button" type="submit">Submit</button>
</form>
{% endif %}
<script type="text/javascript">
function myFunction(divID) {
@ -69,7 +75,7 @@
{{ comment.body }}
<div>
{% if comment.upvoted == False %}
{% if comment.upvoted == False and user.is_authenticated %}
<form action="{% url 'news:upvote' comment.id %}" method="post" class="inline">
{% csrf_token %}
<button class="primary_button" type="submit">+1</button>
@ -86,11 +92,18 @@
<button class="secondary_button inline" onclick="myFunction('{{ comment.id }}')">reply</button>
<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">
{% csrf_token %}
<textarea id="text_{{ comment.id}}" name="body" rows="3" cols="50"></textarea>
<button id="sub_{{ comment.id}}" class="primary_button" type="submit">Submit</button>
</form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to reply
</p>
{% endif %}
</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 %}
{% if validlink %}
<h3>Change password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="primary_button" type="submit">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{% endif %}
{% if validlink %}
<p>Please enter your new password twice so we can verify you typed it in correctly.</p>
<form method="post">{% csrf_token %}
<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>
{% else %}
<p>The password reset link was invalid, possibly because it has already been used. Please request a new password reset.</p>
{% endif %}
{% 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 %}

@ -27,11 +27,12 @@ urlpatterns = [
template_name='news/user/password_reset_form.html',
email_template_name='news/user/password_reset_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'
), 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('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',
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'),
success_url='password-change/done'), name='password_reset_confirm'),
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']
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

Loading…
Cancel
Save