is_active is not changing when custom user logged outHow to check if a user is logged in (how to properly use user.is_authenticated)?django - inlineformset_factory with more than one ForeignKeyDjango south migration error with unique field in postgresql databaseWhat is wrong with my models.py?Radio buttons in django adminFor statement in django templates doesn't work'NoneType' object is not subscriptable in using django smart selectsDjango-Rest-Framework - How to serialize queryset from an unrelated model as nested serializerHow to expose some specific fields of model_b based on a field of model_a?Customer User Authentication error : AttributeError: Manager isn't available; 'auth.User' has been swapped for 'user_management.CustomUser'How to implement update_or_create inside create method of ModelSerializer

Testing if os.path.exists with ArcPy?

Wiring a 4 channel relay - is this possible?

Should I communicate in my applications that I'm unemployed out of choice rather than because nobody will have me?

Single word that parallels "Recent" when discussing the near future

Why are lawsuits between the President and Congress not automatically sent to the Supreme Court

Formal Definition of Dot Product

Why would someone open a Netflix account using my Gmail address?

Could there be something like aerobatic smoke trails in the vacuum of space?

Will there be more tax deductions if I put the house completely under my name, versus doing a joint ownership?

Would life always name the light from their sun "white"

What color to choose as "danger" if the main color of my app is red

Why commonly or frequently used fonts sizes are even numbers like 10px, 12px, 16px, 24px, or 32px?

Was the dragon prowess intentionally downplayed in S08E04?

How will the lack of ground stations affect navigation?

Why is Drogon so much better in battle than Rhaegal and Viserion?

Why is the Advance Variation considered strong vs the Caro-Kann but not vs the Scandinavian?

How to describe a building set which is like LEGO without using the "LEGO" word?

What was Varys trying to do at the beginning of S08E05?

It is as easy as A B C, Figure out U V C from the given relationship

Which creature is depicted in this Xanathar's Guide illustration of a war mage?

Given 0s on Assignments with suspected and dismissed cheating?

Developers demotivated due to working on same project for more than 2 years

How to check if comma list is empty?

What is the effect of the Feeblemind spell on Ability Score Improvements?



is_active is not changing when custom user logged out


How to check if a user is logged in (how to properly use user.is_authenticated)?django - inlineformset_factory with more than one ForeignKeyDjango south migration error with unique field in postgresql databaseWhat is wrong with my models.py?Radio buttons in django adminFor statement in django templates doesn't work'NoneType' object is not subscriptable in using django smart selectsDjango-Rest-Framework - How to serialize queryset from an unrelated model as nested serializerHow to expose some specific fields of model_b based on a field of model_a?Customer User Authentication error : AttributeError: Manager isn't available; 'auth.User' has been swapped for 'user_management.CustomUser'How to implement update_or_create inside create method of ModelSerializer






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am working on custom user model, but the logout feature is not synchronized with root password. is_active(here activated) variable is not changing to False when I logout and the superuser logged in Django admin gets logout when logout button is pressed in the front end user. How to fix this.



models.py



class Users(AbstractBaseUser, PermissionsMixin):
objects = UserManager()
mobile_no = models.IntegerField(_('MobNumber'), null=True, blank=True,unique=True)
email = models.EmailField(_('Email'), max_length=75, null=False, blank=False)
first_name = models.CharField(_('FirstName'), max_length=50, null=True, blank=True)
last_name = models.CharField(_('LastName'), max_length=70, null=True, blank=True)
role = models.CharField(_('Role'), max_length=70, null=True, blank=True)
location = models.CharField(_('Location'), max_length=70, null=True, blank=True)
date_time = models.DateTimeField(_('DateTime'), auto_now=True, null=True, blank=True)
activated = models.BooleanField(_('activated'), default=False)
is_admin = models.BooleanField(_('is_admin'), default=False)
is_itstaff = models.BooleanField(_('is_staff'), default=False)

def __unicode__(self):
return str(self.mobile_no)

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

def get_full_name(self):
return self.first_name + " " + self.last_name

class Meta:
ordering = ['-id']

@property
def is_staff(self):
return self.is_admin


def has_perm(self, perm, obj=None):
return self.is_admin

def has_module_perms(self, app_label):
return self.is_admin

USERNAME_FIELD = 'mobile_no'
REQUIRED_FIELDS = ['role']


views.py



@login_required
def user_logout(request):
logout(request)
return HttpResponseRedirect(reverse('login'))









share|improve this question






















  • logout() clears the current session of the user, both in frontend and django Admin.

    – Jibin Mathews
    Mar 23 at 15:23











  • Is there any way to prevent that. And how to solve the is_active variable problem.

    – VA splash
    Mar 23 at 15:27











  • 'is_active' determines is the account can login or not. If you set it to False then you can't login.

    – shafik
    Mar 23 at 15:32











  • How Django is able to track the current user is logged in or not?

    – VA splash
    Mar 23 at 15:36






  • 1





    is_active(here activated) variable is not changing, that's not why is_active is for. It is there to determine if the user is active and can login or the user is inactive/suspended and can't login.

    – Bidhan Majhi
    Mar 24 at 6:58

















0















I am working on custom user model, but the logout feature is not synchronized with root password. is_active(here activated) variable is not changing to False when I logout and the superuser logged in Django admin gets logout when logout button is pressed in the front end user. How to fix this.



models.py



class Users(AbstractBaseUser, PermissionsMixin):
objects = UserManager()
mobile_no = models.IntegerField(_('MobNumber'), null=True, blank=True,unique=True)
email = models.EmailField(_('Email'), max_length=75, null=False, blank=False)
first_name = models.CharField(_('FirstName'), max_length=50, null=True, blank=True)
last_name = models.CharField(_('LastName'), max_length=70, null=True, blank=True)
role = models.CharField(_('Role'), max_length=70, null=True, blank=True)
location = models.CharField(_('Location'), max_length=70, null=True, blank=True)
date_time = models.DateTimeField(_('DateTime'), auto_now=True, null=True, blank=True)
activated = models.BooleanField(_('activated'), default=False)
is_admin = models.BooleanField(_('is_admin'), default=False)
is_itstaff = models.BooleanField(_('is_staff'), default=False)

def __unicode__(self):
return str(self.mobile_no)

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

def get_full_name(self):
return self.first_name + " " + self.last_name

class Meta:
ordering = ['-id']

@property
def is_staff(self):
return self.is_admin


def has_perm(self, perm, obj=None):
return self.is_admin

def has_module_perms(self, app_label):
return self.is_admin

USERNAME_FIELD = 'mobile_no'
REQUIRED_FIELDS = ['role']


views.py



@login_required
def user_logout(request):
logout(request)
return HttpResponseRedirect(reverse('login'))









share|improve this question






















  • logout() clears the current session of the user, both in frontend and django Admin.

    – Jibin Mathews
    Mar 23 at 15:23











  • Is there any way to prevent that. And how to solve the is_active variable problem.

    – VA splash
    Mar 23 at 15:27











  • 'is_active' determines is the account can login or not. If you set it to False then you can't login.

    – shafik
    Mar 23 at 15:32











  • How Django is able to track the current user is logged in or not?

    – VA splash
    Mar 23 at 15:36






  • 1





    is_active(here activated) variable is not changing, that's not why is_active is for. It is there to determine if the user is active and can login or the user is inactive/suspended and can't login.

    – Bidhan Majhi
    Mar 24 at 6:58













0












0








0








I am working on custom user model, but the logout feature is not synchronized with root password. is_active(here activated) variable is not changing to False when I logout and the superuser logged in Django admin gets logout when logout button is pressed in the front end user. How to fix this.



models.py



class Users(AbstractBaseUser, PermissionsMixin):
objects = UserManager()
mobile_no = models.IntegerField(_('MobNumber'), null=True, blank=True,unique=True)
email = models.EmailField(_('Email'), max_length=75, null=False, blank=False)
first_name = models.CharField(_('FirstName'), max_length=50, null=True, blank=True)
last_name = models.CharField(_('LastName'), max_length=70, null=True, blank=True)
role = models.CharField(_('Role'), max_length=70, null=True, blank=True)
location = models.CharField(_('Location'), max_length=70, null=True, blank=True)
date_time = models.DateTimeField(_('DateTime'), auto_now=True, null=True, blank=True)
activated = models.BooleanField(_('activated'), default=False)
is_admin = models.BooleanField(_('is_admin'), default=False)
is_itstaff = models.BooleanField(_('is_staff'), default=False)

def __unicode__(self):
return str(self.mobile_no)

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

def get_full_name(self):
return self.first_name + " " + self.last_name

class Meta:
ordering = ['-id']

@property
def is_staff(self):
return self.is_admin


def has_perm(self, perm, obj=None):
return self.is_admin

def has_module_perms(self, app_label):
return self.is_admin

USERNAME_FIELD = 'mobile_no'
REQUIRED_FIELDS = ['role']


views.py



@login_required
def user_logout(request):
logout(request)
return HttpResponseRedirect(reverse('login'))









share|improve this question














I am working on custom user model, but the logout feature is not synchronized with root password. is_active(here activated) variable is not changing to False when I logout and the superuser logged in Django admin gets logout when logout button is pressed in the front end user. How to fix this.



models.py



class Users(AbstractBaseUser, PermissionsMixin):
objects = UserManager()
mobile_no = models.IntegerField(_('MobNumber'), null=True, blank=True,unique=True)
email = models.EmailField(_('Email'), max_length=75, null=False, blank=False)
first_name = models.CharField(_('FirstName'), max_length=50, null=True, blank=True)
last_name = models.CharField(_('LastName'), max_length=70, null=True, blank=True)
role = models.CharField(_('Role'), max_length=70, null=True, blank=True)
location = models.CharField(_('Location'), max_length=70, null=True, blank=True)
date_time = models.DateTimeField(_('DateTime'), auto_now=True, null=True, blank=True)
activated = models.BooleanField(_('activated'), default=False)
is_admin = models.BooleanField(_('is_admin'), default=False)
is_itstaff = models.BooleanField(_('is_staff'), default=False)

def __unicode__(self):
return str(self.mobile_no)

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

def get_full_name(self):
return self.first_name + " " + self.last_name

class Meta:
ordering = ['-id']

@property
def is_staff(self):
return self.is_admin


def has_perm(self, perm, obj=None):
return self.is_admin

def has_module_perms(self, app_label):
return self.is_admin

USERNAME_FIELD = 'mobile_no'
REQUIRED_FIELDS = ['role']


views.py



@login_required
def user_logout(request):
logout(request)
return HttpResponseRedirect(reverse('login'))






django django-models django-login django-custom-user






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 15:20









VA splashVA splash

2410




2410












  • logout() clears the current session of the user, both in frontend and django Admin.

    – Jibin Mathews
    Mar 23 at 15:23











  • Is there any way to prevent that. And how to solve the is_active variable problem.

    – VA splash
    Mar 23 at 15:27











  • 'is_active' determines is the account can login or not. If you set it to False then you can't login.

    – shafik
    Mar 23 at 15:32











  • How Django is able to track the current user is logged in or not?

    – VA splash
    Mar 23 at 15:36






  • 1





    is_active(here activated) variable is not changing, that's not why is_active is for. It is there to determine if the user is active and can login or the user is inactive/suspended and can't login.

    – Bidhan Majhi
    Mar 24 at 6:58

















  • logout() clears the current session of the user, both in frontend and django Admin.

    – Jibin Mathews
    Mar 23 at 15:23











  • Is there any way to prevent that. And how to solve the is_active variable problem.

    – VA splash
    Mar 23 at 15:27











  • 'is_active' determines is the account can login or not. If you set it to False then you can't login.

    – shafik
    Mar 23 at 15:32











  • How Django is able to track the current user is logged in or not?

    – VA splash
    Mar 23 at 15:36






  • 1





    is_active(here activated) variable is not changing, that's not why is_active is for. It is there to determine if the user is active and can login or the user is inactive/suspended and can't login.

    – Bidhan Majhi
    Mar 24 at 6:58
















logout() clears the current session of the user, both in frontend and django Admin.

– Jibin Mathews
Mar 23 at 15:23





logout() clears the current session of the user, both in frontend and django Admin.

– Jibin Mathews
Mar 23 at 15:23













Is there any way to prevent that. And how to solve the is_active variable problem.

– VA splash
Mar 23 at 15:27





Is there any way to prevent that. And how to solve the is_active variable problem.

– VA splash
Mar 23 at 15:27













'is_active' determines is the account can login or not. If you set it to False then you can't login.

– shafik
Mar 23 at 15:32





'is_active' determines is the account can login or not. If you set it to False then you can't login.

– shafik
Mar 23 at 15:32













How Django is able to track the current user is logged in or not?

– VA splash
Mar 23 at 15:36





How Django is able to track the current user is logged in or not?

– VA splash
Mar 23 at 15:36




1




1





is_active(here activated) variable is not changing, that's not why is_active is for. It is there to determine if the user is active and can login or the user is inactive/suspended and can't login.

– Bidhan Majhi
Mar 24 at 6:58





is_active(here activated) variable is not changing, that's not why is_active is for. It is there to determine if the user is active and can login or the user is inactive/suspended and can't login.

– Bidhan Majhi
Mar 24 at 6:58












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315253%2fis-active-is-not-changing-when-custom-user-logged-out%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315253%2fis-active-is-not-changing-when-custom-user-logged-out%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript