These are chat archives for django/django

10th
Jul 2018
MilanRgm
@MilanRgm
Jul 10 2018 00:40
i should be able to login as agent, manufacturer or agency
@funkybob Am i on the right track?
Curtis Maloney
@funkybob
Jul 10 2018 00:45
nullable char fields are almost always not what you want... blank is enough most of the time
MilanRgm
@MilanRgm
Jul 10 2018 00:45
thank you. I will note this and update it.
Should i have to subclass AbstractUser to track if its a agent or agency or manufacturer? Because, user should get to login as agent, agency or manufacturer.
MilanRgm
@MilanRgm
Jul 10 2018 07:32
class User(AbstractBaseUser):
  USER_TYPE = (
    ('agent', 'Agent'),
    ('agency', 'Agency'),
    ('manufacturer', 'Manufacturer'),
  )
  user_type = models.CharField(choices=USER_TYPE)
  # update below filed based on the value of user_type in create_user
  is_agent = models.BooleanField(default=False)
  is_agency = models.BooleanField(default=False)
  is_manufacturer = models.BooleanField(default=False)
i am thinking of this now
Lakshminp
@badri
Jul 10 2018 07:48
@MilanRgm will you be having different user attributes for each user type? Then you are better off using a user profile approach.
MilanRgm
@MilanRgm
Jul 10 2018 07:50
yes you can see my agent, agency and manufacturer model. They all have different attribute.
User need to get login as agent or agency or manufacturer so I need to add the fields in signup i think
Lakshminp
@badri
Jul 10 2018 12:36
Just figure out the user type in signup form and create the appropriate userprofile model instance, with FK reference to the user, as highlighted in post above.
Sivabudh Umpudh
@sivabudh
Jul 10 2018 12:44
Hello, is there anyone using Django with microservices? If so, how do you centralize the system's authentication when you have a bunch of services running?
Ross Crawford-d'Heureuse
@rosscdh
Jul 10 2018 18:02
@sivabudh have an auth service that answers initial authentication request and provides a JWT, which can be palmed around.
Sivabudh Umpudh
@sivabudh
Jul 10 2018 18:03
Thanks, Ross.
Ross Crawford-d'Heureuse
@rosscdh
Jul 10 2018 18:03
is just one potential ..
Sivabudh Umpudh
@sivabudh
Jul 10 2018 18:03
The auth service needs to be built by myself?
I wasl looking at Django CAS
But it seems to not play too well with JWT
I wonder what's the canonical way of taking a vanilla Django and to make it support centralized authentication
Ross Crawford-d'Heureuse
@rosscdh
Jul 10 2018 18:30
cas is probably best then. dont let jwt rule it out
Sivabudh Umpudh
@sivabudh
Jul 10 2018 18:31
For what it's worth
How did you implement yours? JWT?
I already tried CAS. Didn't work though.
Ross Crawford-d'Heureuse
@rosscdh
Jul 10 2018 18:33
good article
if it was greenfields do it as proposed by the article using microservices architecture (drf jwt)
but if legacy can be tricky
Sivabudh Umpudh
@sivabudh
Jul 10 2018 18:38
Mine is green
Did you use this library...