[Answer]-Django user authentication, shoulid admin be used or created from view?

1👍

I would prefer using Django’s built in authentication system. Lets assume that you’d want to create you own customer model with say mobile number and twitter handle, you can extend Django’s User model by following

from django.contrib.auth.models import User

class Customer(User):
    mobile = models.CharField(max_length=12)
    twitter = models.CharField(max_length=100)

In this case not only would you inherit attributes like email, username etc from Django’s User model but you’ll also add you custom attributes that you can store in database.

The easiest approach to securing your pages would be to use login_required decorator. Also take care of including right URLs while securing your pages to make sure you have included Django’s login and logout URLs

Leave a comment