models: add User.keepalive field (#67901)
This commit is contained in:
parent
35de406c1b
commit
fa52e3739c
|
@ -543,7 +543,7 @@ class BaseUserSerializer(serializers.ModelSerializer):
|
|||
'required': False,
|
||||
}
|
||||
}
|
||||
exclude = ('user_permissions', 'groups')
|
||||
exclude = ('user_permissions', 'groups', 'keepalive')
|
||||
|
||||
|
||||
class DuplicateUserSerializer(BaseUserSerializer):
|
||||
|
|
|
@ -273,6 +273,9 @@ class ImportUserForm(BaseUserForm):
|
|||
raise ValidationError(_('Invalid password format or unknown hashing algorithm.'))
|
||||
return password_hash
|
||||
|
||||
class Meta:
|
||||
exclude = ('keepalive',)
|
||||
|
||||
|
||||
class ImportUserFormWithExternalId(ImportUserForm):
|
||||
locals()[SOURCE_NAME] = forms.CharField(
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.26 on 2022-10-06 19:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0032_auto_20220919_1230'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='keepalive',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='Keepalive timestamp'),
|
||||
),
|
||||
]
|
|
@ -235,6 +235,8 @@ class User(AbstractBaseUser):
|
|||
verified_attributes = AttributesDescriptor(verified=True)
|
||||
is_verified = IsVerifiedDescriptor()
|
||||
|
||||
keepalive = models.DateTimeField(verbose_name=_('Keepalive timestamp'), null=True, blank=True)
|
||||
|
||||
attribute_values = GenericRelation('authentic2.AttributeValue')
|
||||
|
||||
USERNAME_FIELD = 'username'
|
||||
|
|
|
@ -180,7 +180,15 @@ class UserEditForm(LimitQuerysetFormMixin, CssClass, BaseUserForm):
|
|||
|
||||
class Meta:
|
||||
model = User
|
||||
exclude = ('is_staff', 'groups', 'user_permissions', 'last_login', 'date_joined', 'password')
|
||||
exclude = (
|
||||
'is_staff',
|
||||
'groups',
|
||||
'user_permissions',
|
||||
'last_login',
|
||||
'date_joined',
|
||||
'password',
|
||||
'keepalive',
|
||||
)
|
||||
|
||||
|
||||
class UserChangePasswordForm(CssClass, forms.ModelForm):
|
||||
|
|
|
@ -90,6 +90,7 @@ class SerializerTests(TestCase):
|
|||
'ou': None,
|
||||
'deactivation': None,
|
||||
'deactivation_reason': None,
|
||||
'keepalive': None,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue