18 lines
444 B
Python
18 lines
444 B
Python
"""用户资料表单。"""
|
|
|
|
from django import forms
|
|
|
|
from .models import UserProfile
|
|
|
|
TIMEZONE_CHOICES = [("Asia/Shanghai", "中国标准时间(上海)")]
|
|
|
|
|
|
class UserProfileForm(forms.ModelForm):
|
|
"""只暴露第一阶段允许用户自行修改的资料字段。"""
|
|
|
|
timezone = forms.ChoiceField(label="时区", choices=TIMEZONE_CHOICES)
|
|
|
|
class Meta:
|
|
model = UserProfile
|
|
fields = ("display_name", "timezone")
|