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
# 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
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
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
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
@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
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
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
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
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,
>
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
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
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
...
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
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
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
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
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
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
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
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-
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
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
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
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
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
>
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
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):
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
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
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
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
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..
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
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
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
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
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
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
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.
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
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
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
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):
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(
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:
>
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
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
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
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
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
51 matches
Mail list logo