From f8c408730b7924502a759be418f0447900768d4f Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Mon, 30 Dec 2019 09:33:08 -0500 Subject: [PATCH] Add creation date to public keys --- .../migrations/0005_publickey_created.py | 22 +++++++++++++++++++ src/asymmetric_jwt_auth/models.py | 1 + 2 files changed, 23 insertions(+) create mode 100644 src/asymmetric_jwt_auth/migrations/0005_publickey_created.py diff --git a/src/asymmetric_jwt_auth/migrations/0005_publickey_created.py b/src/asymmetric_jwt_auth/migrations/0005_publickey_created.py new file mode 100644 index 0000000..a7001a5 --- /dev/null +++ b/src/asymmetric_jwt_auth/migrations/0005_publickey_created.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-27 13:09 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('asymmetric_jwt_auth', '0004_auto_20191104_1628'), + ] + + operations = [ + migrations.AddField( + model_name='publickey', + name='created', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + ] diff --git a/src/asymmetric_jwt_auth/models.py b/src/asymmetric_jwt_auth/models.py index 9496ac2..3127aed 100644 --- a/src/asymmetric_jwt_auth/models.py +++ b/src/asymmetric_jwt_auth/models.py @@ -50,6 +50,7 @@ def update_last_used_datetime(self): self.last_used_on = timezone.now() self.save(update_fields=["last_used_on"]) + created = models.DateTimeField(auto_now_add=True) def save(self, *args, **kwargs): key_parts = self.key.split(' ')