Replicating a new database without using manage.py

2019-01-29 Thread pastrufazio
Hi all, I'm creating multi-tenancy capabilities for out back-end application and I need to create a separate database for every current tenant. Playing around with pg_dump and pg_restore, I noticed that a new restored PostgreSQL database is fully functional and I don't need to use the proper *

REST API social authentication

2019-06-21 Thread pastrufazio
Hi all, I need to implement social authentication in my set of REST API. I did some googling and found sever modules, e.g. django-rest-framework-social-oauth2 social-auth-app-django django-rest-social-auth rest-social-auth Can you please recommend me a proper way to deal this? I'm quite a ne

Doubt about Custom User Model

2019-07-04 Thread pastrufazio
Hi! I've read some examples about custom User Model. In all of them, it's suggested implement the class AbtractUser (in this case the app is called *users*) For instance, in this example https://wsvincent.com/django-custom-user-model-tutorial/ they do users/models.pyfrom django.contrib.auth

Need help on how to proceed: django-rest-auth with custom user model

2019-07-17 Thread pastrufazio
Hi all, I'm writing a backend in Django, I want to use *django-rest-auth*(1) to handle registration/email verification/social auth, the problem is that I need to distinguish between two different users: customer and professional My question: is it better to proceed making *django-rest-auth* wor

Update profile on login

2018-11-08 Thread pastrufazio
Hi all, I'm trying to update the field "date_activation" the first time a user log in. This is the error I get when i try to run the code below *TypeError at /admin/login/ int() argument must be a string, a bytes-like object or a number, not 'ModelBase'* Any help would be really appreciated!

Re: Update profile on login

2018-11-09 Thread pastrufazio
Il giorno venerdì 9 novembre 2018 10:29:06 UTC+1, Michal Petrucha ha scritto: > > > Hi, > > Could you please post the full stack trace rather than just the final > error message? That would make it easier to help you. > > Cheers, > Michal > Sure, thanks! Environment: Request Method: PO

Re: Update profile on login

2018-11-09 Thread pastrufazio
Il giorno venerdì 9 novembre 2018 11:37:23 UTC+1, Michal Petrucha ha scritto: Found it. :) The error lies in the filter() call: > > Thank you very much. I fixed it using @receiver(user_logged_in, sender=User) def user_logged_in_callback(sender, user, request, **kwargs): Profile.objects.fi

How to access first_name ad last_name in extended User model

2019-07-24 Thread pastrufazio
Hi all, newbie here! I cannot access self.user.first_name and self.user.last_name in my ClientProfile class, this is the error message: *Instance of 'OneToOneField' has no 'first_name' member* *Instance of 'OneToOneField' has no 'last_name' member* What am I doing wrong? class ClientProfi