0Pricing
Django Academy · Ders

UserCreationForm ile Kayıt

Kullanıcıların güvenli biçimde kaydolmasını sağlayın.

UserCreationForm ile Kayıt, CoddyKit'te ücretsiz bir Django Academy dersidir. Bu, 4 dersinin 3. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Django Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Django Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Let People Sign Up

Login assumes accounts already exist. To let visitors create their own, you need a registration view backed by a sign-up form. ✍️

Meet UserCreationForm

Django gives you UserCreationForm, a ready form with username and two password fields that creates a User on save.

from django.contrib.auth.forms import UserCreationForm

Built-In Password Checks

The form confirms the two passwords match and runs Django's strength validators, so weak or mismatched passwords are rejected automatically.

Show the Form on GET

On a GET request, create an empty form and render it. This is the blank sign-up page the visitor first sees.

form = UserCreationForm()
return render(request, "signup.html", {"form": form})

Bind Data on POST

On a POST, build the form with request.POST so it holds the submitted values, ready to validate.

form = UserCreationForm(request.POST)

Validate Then Save

Call is_valid(); if it passes, form.save() inserts the new user with a properly hashed password. One line creates the account.

if form.is_valid():
    user = form.save()

Log Them In Right Away

A smooth flow signs the user in immediately after sign-up. Call login() with the saved user so they skip a second step.

user = form.save()
login(request, user)

Render the Errors

When validation fails, just render the same form again. It carries error messages that tell the user exactly what to fix.

The Sign-Up Template

Your template wraps the form in a POST and adds csrf_token. Output the fields and a submit button to finish the page.

Extending the Form

Need an email field? Subclass UserCreationForm and add it. The built-in form keeps things minimal until you ask for more.

Redirect After Success

Finish by sending the new user somewhere useful with a redirect, like their dashboard, instead of re-rendering the form.

return redirect("dashboard")

Quick Check

What does UserCreationForm verify about the password automatically?

Recap: Registration

You used UserCreationForm to validate sign-ups, saved the new user with a hashed password, and logged them in right away. ✅

Sıkça Sorulan Sorular

“UserCreationForm ile Kayıt” dersi ücretsiz mi?

Evet — “UserCreationForm ile Kayıt” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Django Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Django Academy kursu toplamda 4 dersten oluşur.

“UserCreationForm ile Kayıt” dersinde ne öğreneceğim?

Kullanıcıların güvenli biçimde kaydolmasını sağlayın. Django Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Django Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Django Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 3. dersidir.

“UserCreationForm ile Kayıt” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Django Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Django Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. User Modeli ve authenticate()
  2. login, logout ve Kimlik Doğrulama Görünümleri
  3. UserCreationForm ile Kayıt
  4. login_required ve Görünümleri Koruma
← Django Academy Sayfasına Dön