These are chat archives for django/django

15th
Sep 2018
Hammour ihab
@hammourihab
Sep 15 2018 15:01
Hey guys, so basically i am looking to use the django built-in authentication system, but instead of using the bloody username i want to use the Email address, does any one has any idea on how to do that or should i build my own auth sys using sessions and so on ?
MilanRgm
@MilanRgm
Sep 15 2018 15:32
does api design depends on how we present in UI?
MilanRgm
@MilanRgm
Sep 15 2018 15:42

will the api design be different if i want the form to be in multiple step? I mean in the https://www.franchisebazar.com/franchisor-registration if you see the form for company registration, there are section like company information, company brand and business model which are associated with company model. The submit button is only one that means there will be only one api for posting the company data.

But what if I want the UI be different(multiple steps wizard form instead of one single big form) like company info in the first step and after submitting company personal info, the next step will be brand and then business model at last. For this do i need to design an api separately? One for company personal info, one for brand and one for business model.

up to now my design is following

https://gist.github.com/MilanRgm/132eb6c0ba0cf66e48fa0ca4c17ef732

I am confused though. Any kind of help from community is highly appreciated.

David Lau
@dalau6
Sep 15 2018 22:37

I currently have

class Login(models.Model):
    user_id = models.AutoField(primary_key=True)
    email_address = models.CharField(max_length=255)
    password = models.CharField(max_length=255)

    def __str__(self):
        return str(self.user_id)

class User(models.Model):
    user_id = models.AutoField(primary_key=True)
    email_address = models.CharField(max_length=255)
    last_name = models.CharField(max_length=255)
    first_name = models.CharField(max_length=255)

How would I go about making user_id my foreign key as well as my primary key?