Answer the question
In order to leave comments, you need to log in
How to customize the user model?
Hello Toaster.
Judging by the documentation, you can make custom user registration.
https://docs.djangoproject.com/en/1.8/topics/auth/...
But, is it possible to completely write your own and generally remove the extra tables that django creates in the database? (a habit after Flask)
If not, then how can I store users in my table (own model) and, when registering, put there the specific data I need. I'm not interested in user groups / date and time of the last login and so on.
Z.Y. Developments:
forms.py
class RegistrationForm(forms.ModelForm):
"""
Form for creating new user
"""
name = forms.CharField(widget = forms.TextInput(attrs={'placeholder': 'Name'}))
surname = forms.CharField(widget = forms.TextInput, label = "Surname")
login = forms.CharField(widget = forms.TextInput, label = "Username")
email = forms.EmailField(widget = forms.TextInput, label = "E-mail")
pswd = forms.CharField(widget = forms.PasswordInput, label = "Password")
pswd_check = forms.CharField(widget = forms.PasswordInput, label = "Repeat password")
def register(request):
form = RegistrationForm()
if request.method == 'POST':
if form.is_valid():
RegistrationForm.save()
return render_to_response('details.html', {'form': form}, RequestContext(request))
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^register/', register),
]
<form action ="" method="POST">
{% csrf_token %}
Name: {{ form.name }} <br><br>
Surname: {{ form.surname }} <br><br>
Login: {{ form.login }} <br><br>
Pass: {{ form.pswd }} <br><br>
Check pass: {{ form.pswd_check }} <br><br>
<button type="submit">Reg</button>
</form>
Answer the question
In order to leave comments, you need to log in
But, is it possible to completely write your own and generally remove the extra tables that django creates in the database? (habit after Flask)
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Maybe this will work:
Python Django (lesson 11) - user registration: https://youtu.be/7SUdbpjQQRI .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question