Skip to content

Commit

Permalink
Add created_at Field to Device Model for Audit and Management Purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
rushikeshiam committed Apr 4, 2024
1 parent 5d46748 commit 62adc5f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/django_otp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ class Device(models.Model):
a device and then ask the user for confirmation. As a rule, built-in
APIs that enumerate devices will only include those that are confirmed.
.. attribute:: created_at
*DateTimeField*: The date and time when the device was added. This field
automatically records the current date and time when a new device instance
is created, aiding in audit and lifecycle management.
.. attribute:: objects
A :class:`~django_otp.models.DeviceManager`.
Expand All @@ -88,6 +94,12 @@ class Device(models.Model):
default=True, help_text="Is this device ready for use?"
)

created_at = models.DateTimeField(
auto_now_add=True,
help_text="The date and time when this device was added.",
null=True
)

objects = DeviceManager()

class Meta:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-04-04 09:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('otp_email', '0005_emaildevice_last_generated_timestamp'),
]

operations = [
migrations.AddField(
model_name='emaildevice',
name='created_at',
field=models.DateTimeField(auto_now_add=True, help_text='The date and time when this device was added.', null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-04-04 09:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('otp_static', '0002_throttling'),
]

operations = [
migrations.AddField(
model_name='staticdevice',
name='created_at',
field=models.DateTimeField(auto_now_add=True, help_text='The date and time when this device was added.', null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-04-04 09:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('otp_totp', '0002_auto_20190420_0723'),
]

operations = [
migrations.AddField(
model_name='totpdevice',
name='created_at',
field=models.DateTimeField(auto_now_add=True, help_text='The date and time when this device was added.', null=True),
),
]

0 comments on commit 62adc5f

Please sign in to comment.