Python Django-the Practical Guide _top_ Access
Run tests:
(create this file)
Apply migrations:
# urls.py from django.contrib.auth import views as auth_views urlpatterns += [ path('login/', auth_views.LoginView.as_view(), name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), ] python django-the practical guide
from django.shortcuts import redirect from .forms import PostForm def create_post(request): if request.method == 'POST': form = PostForm(request.POST) if form.is_valid(): form.save() return redirect('home') else: form = PostForm() return render(request, 'blog/create.html', 'form': form) Django provides django.contrib.auth . Run tests: (create this file) Apply migrations: # urls
– place CSS/JS in blog/static/blog/ and load with % load static % . 8. Forms and ModelForms blog/forms.py python django-the practical guide