from django.contrib.auth.forms import UserCreationForm
class MyUserCreationForm(UserCreationForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for fieldname in ['username', 'password1', 'password2']:
self.fields[fieldname].help_text = None
from .forms import MyUserCreationForm
class RegisterFormView(FormView):
form_class = MyUserCreationForm
success_url = "/login/"
template_name = "home.html"
def form_valid(self, form):
form.save()
return super().form_valid(form)
In [1]: class A(str):
...: def __new__(cls, content, **kwargs):
...: return str.__new__(cls, content)
...: def __init__(self, content, **kwargs):
...: str.__init__(content)
...: self.dictionary = kwargs
...:
In [2]: s = A('he', b='1', c='2')
In [3]: s
Out[3]: 'he'
In [4]: s.upper()
Out[4]: 'HE'
In [5]: s[1]
Out[5]: 'h'
In [6]: s.dictionary
Out[6]: {'b': '1', 'c': '2'}
In [7]: isinstance(s, str)
Out[7]: True
In [8]: type(s)
Out[8]: __main__.A
In [9]: s.__class__.__bases__
Out[9]: (str,)