Add login bits.
This commit is contained in:
parent
870925837a
commit
fa1e4a6b24
@ -43,7 +43,6 @@ INSTALLED_APPS = [
|
||||
'yeast.apps.YeastLabConfig',
|
||||
'beer.apps.BeerConfig',
|
||||
'kegs.apps.KegConfig',
|
||||
#'django.contrib.sites.apps.SitesConfig',
|
||||
'django.contrib.humanize.apps.HumanizeConfig',
|
||||
'django_nyt.apps.DjangoNytConfig',
|
||||
'mptt',
|
||||
@ -59,7 +58,7 @@ INSTALLED_APPS = [
|
||||
MIDDLEWARE = [
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
# 'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
@ -105,7 +104,9 @@ WIKI_ACCOUNT_SIGNUP_ALLOWED = True
|
||||
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
LOGIN_REDIRECT_URL = reverse_lazy('wiki:get', kwargs={'path': ''})
|
||||
LOGIN_REDIRECT_URL = 'home'
|
||||
LOGIN_URL = 'login'
|
||||
LOGOUT_REDIRECT_URL = 'home'
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
|
@ -1,11 +1,16 @@
|
||||
from django.urls import include, path
|
||||
from django.contrib import admin
|
||||
from django.contrib.flatpages import views
|
||||
from .views import home, ChangePasswordView
|
||||
from .views import home
|
||||
|
||||
from django.contrib.sites.models import Site
|
||||
admin.site.unregister(Site)
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('account/', include('django.contrib.auth.urls')),
|
||||
path('about/', views.flatpage, {'url': '/about/'}, name='about'),
|
||||
path("pages/", include('django.contrib.flatpages.urls')),
|
||||
path('yeast/', include(('yeast.urls', 'yeast'))),
|
||||
@ -13,6 +18,6 @@ urlpatterns = [
|
||||
path('kegs/', include(('kegs.urls', 'kegs'))),
|
||||
path('notifications/', include('django_nyt.urls')),
|
||||
path('wiki/', include('wiki.urls')),
|
||||
path('change-password/', ChangePasswordView.as_view(), name='change_password'),
|
||||
#path('change-password/', ChangePasswordView.as_view(), name='change_password'),
|
||||
path('', home, name="home"),
|
||||
]
|
||||
|
@ -5,9 +5,3 @@ from django.urls import reverse_lazy
|
||||
|
||||
def home(request):
|
||||
return render(request, 'home.html',{})
|
||||
|
||||
|
||||
class ChangePasswordView(PasswordChangeView):
|
||||
form_class = PasswordChangeForm
|
||||
success_url = reverse_lazy('home')
|
||||
template_name = 'change_password.html'
|
23
templates/registration/login.html
Normal file
23
templates/registration/login.html
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block style %}
|
||||
form { display: table; }
|
||||
p { display: table-row; }
|
||||
label { display: table-cell; }
|
||||
input { display: table-cell; }
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1 class="display-3">Log In</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<p><p><p>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<button type="submit">Log In</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,4 +1,5 @@
|
||||
from django.urls import include, path
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib import admin
|
||||
from django.contrib.flatpages import views
|
||||
|
||||
@ -10,9 +11,9 @@ urlpatterns = [
|
||||
|
||||
path('samples/<int:yeast_id>/', sample, name='yeast'),
|
||||
path('samples/', YeastListView.as_view(), name='yeasts'),
|
||||
path('batches/addbatch/', addBatch.as_view(), name='addbatch'),
|
||||
path('batches/addstrain/', addStrain.as_view(), name='addstrain'),
|
||||
path('batches/addbatch/', login_required(addBatch.as_view()), name='addbatch'),
|
||||
path('batches/addstrain/', login_required(addStrain.as_view()), name='addstrain'),
|
||||
path('batches/<int:batch_id>/', batch, name='batch'),
|
||||
path('batches/', BatchListView.as_view(), name='batches'),
|
||||
path('batch_labels/<int:batch_id>/', batch_labels, name='labels'),
|
||||
path('batch_labels/<int:batch_id>/', login_required(batch_labels), name='labels'),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user