Re: Custom User models

2023-11-28 Thread Okkert Joubert
Thanks Ahmed Please tell me if I'm correct or not in saying the SchoolUser has School as a foreign key the school will not have to be authenticated with djoser in order to register for example or login? On Mon, Nov 27, 2023 at 6:53 PM Ahmed Iftikhar wrote: > # models.py > from django.contrib.au

Re: Custom User models

2023-11-27 Thread Ahmed Iftikhar
# models.py from django.contrib.auth.models import AbstractUser from django.db import models class School(models.Model): # Your School model fields class SchoolUser(AbstractUser): school = models.ForeignKey(School, on_delete=models.CASCADE) # Add other custom fields as needed

Re: Custom User models

2023-11-27 Thread Clive Bruton
I am taking it that there is more than one "school"? If so, surely it's is just a many-to-many relationship. On 27 Nov 2023, at 09:33, Okkert Joubert wrote: Good morning all, I made a custom user model for a school, it is currently working with djoser authentication, now what I want to add

Re: Custom user model password is not hashed

2023-01-26 Thread Namanya Daniel
Did you try make_password before saving data from registration form ? On Wed, 25 Jan 2023 at 18:36, Roger Mukai wrote: > @Tejas or @Sebs, do you still have a question how to do this? I think I > figured it out > > On Tuesday, December 6, 2022 at 7:25:08 PM UTC-5 sebs...@gmail.com wrote: > >> Hey

Re: Custom user model password is not hashed

2023-01-26 Thread James
Yup, 100% correct. Glad to hear you fixed it. Custom user models that inherit from the abstractbaseuser class can be a little tricky at first. On Friday, November 13, 2015 at 5:41:09 AM UTC-7 benjamin...@gmail.com wrote: > The problem was, when creating a custom user, one has to define a custom

Re: Custom user model password is not hashed

2023-01-25 Thread Roger Mukai
@Tejas or @Sebs, do you still have a question how to do this? I think I figured it out On Tuesday, December 6, 2022 at 7:25:08 PM UTC-5 sebs...@gmail.com wrote: > Hey *Ben*, please help with the repo for the same code. I'm getting same > error > here. > > On Saturday, 7 May 2022 at 22:37:32 UT

Re: Custom user model password is not hashed

2022-12-06 Thread Sage
Hey *Ben*, please help with the repo for the same code. I'm getting same error here. On Saturday, 7 May 2022 at 22:37:32 UTC Tejas Agrawal wrote: > Hey Benjamin, can you please share your github repo for the same code. I'm > also getting the same error in one of my project, can't figure out how

Re: Custom user model password is not hashed

2022-05-07 Thread Tejas Agrawal
Hey Benjamin, can you please share your github repo for the same code. I'm also getting the same error in one of my project, can't figure out how to solve it. On Friday, November 13, 2015 at 6:11:09 PM UTC+5:30 benjamin...@gmail.com wrote: > The problem was, when creating a custom user, one ha

Re: Custom User

2021-05-06 Thread Chetan Ganji
https://docs.djangoproject.com/en/3.2/topics/auth/passwords/#django.contrib.auth.hashers.make_password On Thu, May 6, 2021, 6:46 PM Owen Murithi wrote: > How do I make password for AbstractUser Hashed? > > -- > You received this message because you are subscribed to the Google Groups > "Django u

Re: Custom User Model

2021-04-09 Thread Ángeles
For creating Custom Users I have found util the tutorial: Creating a Custom User Model in Django of Michael Herman https://testdriven.io/blog/django-custom-user-model/ Best wishes. Ángeles. El domingo, 4 de abril de 2021 a la(s) 05:03:37 UTC-5, manue...@gmail.com escribió: > Hi Amitesh, >

Re: Custom User Model

2021-04-04 Thread Manuel Buri
Hi Amitesh, unfortunately, nothing changed... I mean it is just weird that I am having now those different tables in auth and users app (see picture). I can add and manage groups for auth_group but I would love to manage those via users_account_groups any ideas? Also currently my groups are s

Re: Custom User Model

2021-04-03 Thread 'Amitesh Sahay' via Django users
Hello Manuel,  Try the below. Recently I have worked on custom user model: class AccountManager(BaseUserManager): def create_superuser(self, email, password, **extra_fields): extra_fields.setdefault('is_staff', True) extra_fields.setdefault('is_superuser', True) extra_fi

Re: Custom User

2020-03-06 Thread Antje Kazimiers
Hi Kushal, Since the out-of-the box User model is coming from the auth module, you can hardly extend this class. To store additional information for different types of Users, you could create a custom UserProfile model, which has a Foreign Key to the User model: from django.db import models ...

Re: Custom user model password is not hashed

2015-11-13 Thread Benjamin Smith
The problem was, when creating a custom user, one has to define a custom model form and model admin that handles the password properly. After that it was solved. Thank you. On Thu, Nov 12, 2015 at 9:25 PM, Andreas Kuhne wrote: > Try to debug and check what your password value is after the > set

Re: Custom user model password is not hashed

2015-11-12 Thread Andreas Kuhne
Try to debug and check what your password value is after the set_password() statement. Also have you checked the database after trying to create a user with the new method? It should be hashed in the database. This is stuff that should "just work" in django (it's regulated by the AbstractBaseUser

Re: Custom user model password is not hashed

2015-11-12 Thread Benjamin Smith
I have changed user.set_password(self.cleaned_data["password"]) to user.set_password(password). But I am getting the same result. On Thu, Nov 12, 2015 at 8:57 PM, Andreas Kuhne wrote: > As aRkadeFR says, you seam to have mixed code there > > The row: > user.set_password(self.cleaned_data["pa

Re: Custom user model password is not hashed

2015-11-12 Thread Andreas Kuhne
As aRkadeFR says, you seam to have mixed code there The row: user.set_password(self.cleaned_data["password"]) is taken from a form somewhere and won't work. It should instead be : user.set_password(password) I suppose the password is going through to the create method via the kwargs argument

Re: Custom user model password is not hashed

2015-11-12 Thread Thorsten Sanders
If you wanna set the password yourself you need to generate it: https://docs.djangoproject.com/en/1.8/topics/auth/passwords/ scroll down to the bottom and have a lookt at make_password Am 12.11.2015 um 16:11 schrieb Benjamin Smith: I have my own custom User model, and its own Manger too. Mo

Re: Custom user model password is not hashed

2015-11-12 Thread aRkadeFR
Hello, I don't quite get the code in your method: 'MyUserManager.create_user': user.set_password(self.cleaned_data["password"]) You're in your Manager method but call self.cleaned_data ? You can set a breakpoint inside your method with pdb to see what's going on with your fields? On 11/12

Re: Custom User Migration Error

2015-08-02 Thread mddengo
It worked, thanks!! On Sunday, August 2, 2015 at 2:20:07 PM UTC-4, Amitt Bhardwj wrote: > > Try deleting migration folder in your app and run ./manage.py migrate > > On Sun, Aug 2, 2015 at 11:45 PM, > wrote: > > Hi everyone, > > > > I've recently started adding user authentication to my app u

Re: Custom User Migration Error

2015-08-02 Thread Amitt Bhardwj
Try deleting migration folder in your app and run ./manage.py migrate On Sun, Aug 2, 2015 at 11:45 PM, wrote: > Hi everyone, > > I've recently started adding user authentication to my app using Google's > OAuth2. I found a sample app online > (http://blog.jez.io/2014/10/20/using-google-apps-for-

Re: Custom User

2014-09-30 Thread Lachlan Musicman
use list_display: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display Cheers L. On 1 October 2014 13:11, Sachin Tiwari wrote: > Ok sorry for incomplete description, I added a field phone number in user > profile for eg when we click on add us

Re: Custom User

2014-09-30 Thread Sachin Tiwari
Ok sorry for incomplete description, I added a field phone number in user profile for eg when we click on add user button it will show username, password and in my case it will show phone number also but it will not be displayed after saving it. I add from django.contrib.auth.models impo

Re: Custom User

2014-09-30 Thread monoBOT
You aren't asking anything. 2014-09-30 11:44 GMT+01:00 Sachin Tiwari : > Hi Tundebabzy, > > Am I asking something wrong? please help me if possible. > > > On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote: >> >> Hi >> >> I want to display a phone number field at users list p

Re: Custom User

2014-09-30 Thread Babatunde Akinyanmi
Your question is vague. You need to be specific about what you want to do. Let us see what you have tried and let us see the stack trace of any error. Otherwise, your question seems like "hi, I want to build a car". When you put in the details i can assure you that answers will start flying in. O

Re: Custom User

2014-09-30 Thread Sachin Tiwari
Hi Tundebabzy, Am I asking something wrong? please help me if possible. On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote: > > Hi > > I want to display a phone number field at users list page, > > Username emailAddress FirstName LastName staffstatus PhoneNumber >

Re: Custom User

2014-09-30 Thread Babatunde Akinyanmi
Hello Sachin, On 30 Sep 2014 10:50, "Sachin Tiwari" wrote: > > Hi > > I want to display a phone number field at users list page, > > Username emailAddress FirstName LastName staffstatus PhoneNumber > sachin a...@g.com sachintiwari True 00

Re: Custom user model backend

2014-05-29 Thread Kelvin Wong
Maybe try putting some logging in your CustomUserModelBackend. Near the top, put in some logging boilerplate: import logging logger = logging.getLogger(__name__) Then in your backend, something like this: class CustomUserModelBackend(ModelBackend): ... def get_user(self, user_id):

Re: Custom user model backend

2014-05-28 Thread Domagoj Kovač
I already know about SESSION_COOKIE_AGE. I set it to be 30 minutes, but the problem is that even if i am doing something system logs me out, and this should not happen. It work properly before i implemented custom auth backend. -- You received this message because you are subscribed to the Goo

Re: Custom user model backend

2014-05-28 Thread Kelvin Wong
In your settings.py you might have to set the SESSION_COOKIE_AGE https://docs.djangoproject.com/en/1.4/topics/http/sessions/#session-cookie-age K On Wednesday, May 28, 2014 5:49:01 AM UTC-7, Domagoj Kovač wrote: > > Hi guys, > > I extended base user model with certain fields. My code is as foll

Re: Custom User

2014-02-02 Thread Henrique Oliveira
Many thanks Russell, it really make sense. Cheers -Henrique On Sunday, February 2, 2014 8:58:59 PM UTC-2, Russell Keith-Magee wrote: > > Hi Henrique, > > Think of it this way: you have a site, and each person visiting your site, > regardless of whether they're an admin or a member, will have a

Re: Custom User

2014-02-02 Thread Russell Keith-Magee
Hi Henrique, Think of it this way: you have a site, and each person visiting your site, regardless of whether they're an admin or a member, will have a username, password, and a name. This common information is what you put in your user model. That way, everyone who visits your site and has an acc

Re: Custom User

2014-02-02 Thread Timothy W. Cook
Even if you user an alternate USER_MODEL should not put non-user specific things there. See https://django-authtools.readthedocs.org/en/latest/intro.html#but-it-s-supposed-to-be-a-custom-user-model and the referenced links. On Sun, Feb 2, 2014 at 6:18 PM, Henrique Oliveira < henriqueollive..

Re: Custom User

2014-02-02 Thread Henrique Oliveira
Hi Timothy, I see it have officially deprecated the use of user profiles attached to the default user in favor of custom user models. One thing I have noticed in Django 1.6, only one AUTH_USER_MODEL can be used. Any ideas how to deal with this? On Sunday, February 2, 2014 4:26:44 PM UTC-2, Tim

Re: Custom User

2014-02-02 Thread Timothy W. Cook
I suggest, and I believe it is considered best practice by others. To create a profile model for your members with a one to one relationship to the user. Basically you do not want anything in the user model that doesn't apply to all users. On Sun, Feb 2, 2014 at 3:27 PM, Henrique Oliveira < h

Re: Custom User model admin log always adds Changed password record

2013-11-04 Thread John
I noticed if I comment out the line password = ReadOnlyPasswordHashField() in admin.py that I no longer run into this issue when saving, but then the field becomes editable and shows the hash. # appname/models.py from django.db import models from django.contrib.auth.models import ( BaseUser

Re: custom User model and login()

2012-11-11 Thread Russell Keith-Magee
On Mon, Nov 12, 2012 at 2:08 AM, Anil Jangity wrote: > I am trying to build a User model with a dedicated LDAP backend. I have no > SQL database. > > def login(request): >... >login(request, user) >request.user.is_authenticated() ---> return True >return HttpResponseRedirect("/m

Re: Custom User class -> createsuperuser asks for Username twice

2012-10-19 Thread Chris Pagnutti
Right on. Thanks Russ. On Thursday, October 18, 2012 3:38:05 PM UTC-4, Chris Pagnutti wrote: > > Hi. I'm just trying out the new way to create a custom User class by > extending the AbstractBaseUser class. I essentially just copied the > AbstractUser and UserManager classes from auth.models a

Re: Custom User class -> createsuperuser asks for Username twice

2012-10-18 Thread Russell Keith-Magee
On Fri, Oct 19, 2012 at 3:50 AM, Chris Pagnutti wrote: > Blarghh! Ok, I'm serious that I spent considerable time Googling, poring > over the contrib.auth and core files and otherwise staring at my screen to > try to fix this on my own before posting. But of course I figure it out two > minutes a

Re: Custom User class -> createsuperuser asks for Username twice

2012-10-18 Thread Chris Pagnutti
Blarghh! Ok, I'm serious that I spent considerable time Googling, poring over the contrib.auth and core files and otherwise staring at my screen to try to fix this on my own before posting. But of course I figure it out two minutes after I wasted the time of anyone who actually read this post.

Re: custom User class

2011-05-29 Thread Ryan
If all you want to do is store additional information about your users, the recommended way to do this is to use a user profile: https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users Ryan -- You received this message because you are subscribed to the Goo

Re: Custom User Profiles + Signals

2011-03-02 Thread Jeremiah
So continuing with this... I got the print-outs to work (I still need to try Stefano's suggestion)... I register a new user (duh6) via my register page and in the output for the dev server, I see: in myproject.cc.models: for user , pr ofile already exists in cc.models: for user , profile alread

Re: Custom User Profiles + Signals

2011-03-02 Thread bruno desthuilliers
On 2 mar, 19:31, Jeremiah wrote: (snip) >> Given the above statement, I assume the "models.py" file you're >> talking about is not the one where you define your UserProfile class. (snip) > It is the same models.py file with the UserProfile class.  Is this the > incorrect way to set this up?  I h

Re: Custom User Profiles + Signals

2011-03-02 Thread Jeremiah
I appreciate all of your feedback! My comments inserted within the message below: > What does cc.models.UserProfile looks like ? class UserProfile(models.Model): user = models.OneToOneField(User) thing = models.CharField(max_length=200) def __unicode__(self):

Re: Custom User Profiles + Signals

2011-03-02 Thread Wandering Weezard
I'll give that a shot. Thank you for your feedback. Still learning a lot as I go. On Tue, Mar 1, 2011 at 8:07 PM, Stefano wrote: > why you don't create the profile only if needed ? > > class UserProfile(models.Model): >user = models.ForeignKey(User, unique=True) > > User.profile = property(

Re: Custom User Profiles + Signals

2011-03-02 Thread bruno desthuilliers
On 2 mar, 00:50, Jeremiah wrote: > Hi All, > > So, if I do the following from the shell (as spawned by manage.py): > >>> import cc.models What does cc.models.UserProfile looks like ? > >>> from django.contrib.auth.models import User > >>> u = User.objects.get(username__exact="duh3") > >>> try: >

Re: Custom User Profiles + Signals

2011-03-01 Thread Stefano
why you don't create the profile only if needed ? class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0]) 2011/3/2 Jeremiah : > Hi All, > > I'm going through the help document (http://docs.dj

Re: Custom User Model and the Django Admin Site

2009-08-29 Thread Bryan
Thanks for your help. Perhaps I should have been more clear and included more information, because that is exactly what I was asking about. I was hoping that someone had already solved this problem and could fill me in on how they got it working. Btw, my first post was written in pieces while d

Re: Custom User Model and the Django Admin Site

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 10:20 AM, Bryan wrote: > > So, my "solution" was to duplicate this logic in my admin class, and > it works just fine now. Anyone have any better ideas? Base your admin class on the UserAdmin class. Inherit whatever you need from it and override whatever you want to cust

Re: Custom User model in django.contrib.auth

2007-10-02 Thread Leo
In addition, I think if you duplicate the existing auth app under another name, you're not going to be able to use the django.contrib applications, since lots of those (like admin) count on being able to do database joins between their table and the existing auth app's model objects. In other wor

Re: Custom User model in django.contrib.auth

2007-10-01 Thread Russell Keith-Magee
On 10/2/07, handsome greg <[EMAIL PROTECTED]> wrote: > > Extending the model to add more fields isn't really > an issue for me, I would just really like to use my own table but keep > the django.contrib.auth functionality without hacking the source. Is > this possible in any way currently? Thanks