mirror of
https://github.com/AxioDL/axiodl-www.git
synced 2026-07-11 06:19:06 -07:00
Cleanup login form
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ class Profile(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
avatar = models.ImageField(upload_to=path_and_rename, null=True, blank=True)
|
||||
birthdate = models.DateTimeField(null=True, blank=True)
|
||||
use_gravatar = models.BooleanField(blank=True, default=False)
|
||||
use_gravatar = models.BooleanField(blank=True, default=False, verbose_name='Use Avatars from Gravatar?')
|
||||
location = models.CharField(max_length=100, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -1,25 +1,113 @@
|
||||
{% extends 'base_accounts.html' %}
|
||||
|
||||
{% load form_tags widget_tweaks static %}
|
||||
{% block title %}Sign up to AxioDL{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-8 col-md-10 col-sm-12">
|
||||
<div class="card border-dark">
|
||||
<div class="card-header bg-dark text-light">
|
||||
<div class="d-flex p-2 justify-content-center mb-4">
|
||||
<div class="card border-dark bg-dark">
|
||||
<div class="card-header bg-dark text-light align-text-center">
|
||||
<div class="card-title"><h2 class="card-title">Sign up</h2></div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<form method="post" novalidate>
|
||||
<div class="card-body bg-light border-dark">
|
||||
<h3>*Denotes required fields</h3>
|
||||
{% csrf_token %}
|
||||
{% include 'includes/form.html' %}
|
||||
<button type="submit" class="btn btn-primary btn-block">Create an account</button>
|
||||
</form>
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{% for error in form.non_field_errors %}
|
||||
<p{% if forloop.last %} class="mb-0"{% endif %}>{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- Profile username -->
|
||||
*{{ form.user.username.label_tag }}
|
||||
{% render_field form.user.username class=form.user.username|input_class %}
|
||||
{% for error in form.user.username.errors %}
|
||||
<div class="invalid-feedback">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if form.user.username.help_text %}
|
||||
<small class="form-text text-muted">
|
||||
{{ form.user.username.help_text|safe }}
|
||||
</small>
|
||||
{% endif %}
|
||||
<!-- Profile email -->
|
||||
*{{ form.user.email.label_tag }}
|
||||
{% render_field form.user.email class=form.user.email|input_class %}
|
||||
{% for error in form.user.email.errors %}
|
||||
<div class="invalid-feedback">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if form.user.email.help_text %}
|
||||
<small class="form-text text-muted">
|
||||
{{ form.user.email.help_text|safe }}
|
||||
</small>
|
||||
{% endif %}
|
||||
<!-- Profile password -->
|
||||
*{{ form.user.password1.label_tag }}
|
||||
{% render_field form.user.password1 class=form.user.password1|input_class %}
|
||||
{% for error in form.user.password1.errors %}
|
||||
<div class="invalid-feedback">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if form.user.password1.help_text %}
|
||||
<small class="form-text text-muted">
|
||||
{{ form.user.password1.help_text|safe }}
|
||||
</small>
|
||||
{% endif %}
|
||||
<!-- Profile password confirmation -->
|
||||
*{{ form.user.password2.label_tag }}
|
||||
{% render_field form.user.password2 class=form.user.password2|input_class %}
|
||||
{% for error in form.user.password2.errors %}
|
||||
<div class="invalid-feedback">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if form.user.password2.help_text %}
|
||||
<small class="form-text text-muted">
|
||||
{{ form.user.password2.help_text|safe }}
|
||||
</small>
|
||||
{% endif %}
|
||||
<!-- Profile avatar -->
|
||||
{{ form.profile.avatar.label_tag }}
|
||||
{% render_field form.profile.avatar %}
|
||||
{% for error in form.profile.avatar.errors %}
|
||||
<div class="invalid-feedback">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if form.profile.avatar.help_text %}
|
||||
<small class="form-text text-muted">
|
||||
{{ form.profile.avatar.help_text|safe }}
|
||||
</small>
|
||||
{% endif %}
|
||||
|
||||
<!-- Profile use_gravatar -->
|
||||
<div class="form-check">
|
||||
{% render_field form.profile.use_gravatar class=form.profile.use_gravatar|input_class %}
|
||||
{{ form.profile.use_gravatar.label_tag }}
|
||||
{% for error in form.profile.use_gravatar.errors %}
|
||||
<div class="invalid-feedback">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if form.profile.use_gravatar.help_text %}
|
||||
<small class="form-text text-muted">
|
||||
{{ form.profile.use_gravatar.help_text|safe }}
|
||||
</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-block">Create an account</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="card-footer text-muted text-center">
|
||||
Already have an account? <a href="{% url 'login' %}">Log in</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from django.db.models import Count
|
||||
from django.utils import timezone
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import UpdateView, ListView
|
||||
from django.views.generic import UpdateView, ListView, CreateView, DeleteView
|
||||
from .forms import NewTopicForm, PostForm
|
||||
from .models import Category, Board, Topic, Post
|
||||
|
||||
@@ -26,7 +26,7 @@ class TopicListView(ListView):
|
||||
return queryset
|
||||
|
||||
|
||||
@login_required
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
def new_topic(request, pk):
|
||||
board = get_object_or_404(Board, pk=pk)
|
||||
if request.method == 'POST':
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% block title %}Test page{% endblock %}
|
||||
@@ -120,6 +120,14 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% block javascript %}{% endblock %}
|
||||
<div class="footer py-1 bg-dark text-white-50 text-center" style="z-index:20">
|
||||
<small style="font-size:1.0em">Copyleft <span class="copy-left" ;>©</span> AxioDL, written in <a
|
||||
href="https://python.org/">Python</a> using <a href="https://www.djangoproject.com/">Django</a>.
|
||||
The source code for this website is available on our gitlab instance <a
|
||||
href="https://gitlab.axiodl.com/AxioDL/axiodl-www">here</a>
|
||||
</small>
|
||||
</div>
|
||||
{% endblock %}
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
|
||||
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
|
||||
@@ -148,13 +156,5 @@
|
||||
});
|
||||
$('.ui.dropdown').dropdown();
|
||||
</script>
|
||||
{% block javascript %}{% endblock %}
|
||||
<div class="footer py-1 bg-dark text-white-50 text-center" style="z-index:20">
|
||||
<small style="font-size:1.0em">Copyleft <span class="copy-left" ;>©</span> AxioDL, written in <a
|
||||
href="https://python.org/">Python</a> using <a href="https://www.djangoproject.com/">Django</a>.
|
||||
The source code for this website is available on our gitlab instance <a
|
||||
href="https://gitlab.axiodl.com/AxioDL/axiodl-www">here</a>
|
||||
</small>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user