Merge pull request #2831 from normanjaeckel/UserLoginTimestamp
Skipped autoupdate for user during login. See #2804.
This commit is contained in:
commit
4b03a7ad5b
@ -14,6 +14,7 @@ from django.db.models import Prefetch, Q
|
|||||||
|
|
||||||
from openslides.utils.search import user_name_helper
|
from openslides.utils.search import user_name_helper
|
||||||
|
|
||||||
|
from ..utils.collection import CollectionElement
|
||||||
from ..utils.models import RESTModelMixin
|
from ..utils.models import RESTModelMixin
|
||||||
from .access_permissions import GroupAccessPermissions, UserAccessPermissions
|
from .access_permissions import GroupAccessPermissions, UserAccessPermissions
|
||||||
|
|
||||||
@ -196,6 +197,16 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser):
|
|||||||
# Return result
|
# Return result
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Overridden method to skip autoupdate if only last_login field was
|
||||||
|
updated as it is done during login.
|
||||||
|
"""
|
||||||
|
if kwargs.get('update_fields') == ['last_login']:
|
||||||
|
kwargs['skip_autoupdate'] = True
|
||||||
|
CollectionElement.from_instance(self)
|
||||||
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
def get_search_index_string(self):
|
def get_search_index_string(self):
|
||||||
"""
|
"""
|
||||||
Returns a string that can be indexed for the search.
|
Returns a string that can be indexed for the search.
|
||||||
|
@ -73,7 +73,12 @@ class Index:
|
|||||||
pass
|
pass
|
||||||
path = self.get_index_path()
|
path = self.get_index_path()
|
||||||
if path != 'ram' and exists_in(path):
|
if path != 'ram' and exists_in(path):
|
||||||
|
# Quick fix to bypass errors when many clients login.
|
||||||
|
# TODO: Solve this hack.
|
||||||
|
try:
|
||||||
return open_dir(path)
|
return open_dir(path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
return self.create_index()
|
return self.create_index()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user