from django.db import models class User(models.Model): name = models.CharField(max_length=50) email = models.EmailField(unique=True) username = models.CharField(max_length=30, unique=True) password = models.CharField(max_length=100) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) def __str__(self): return self.username
from django import forms from .models import User class RegistrationForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput) class Meta: model = User fields = ('name', 'email', 'username', 'password')This code is using Django's built-in ModelForm class to create a form that allows users to register with their name, email, username, and password fields. It also includes a PasswordInput widget to keep passwords private. This is another example of how the User model can be used in a Python application.