Skip to content

Commit 3c2a3bc

Browse files
committed
feat(accounts,ToU): add updated and created to Consent Model
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
1 parent 8c2a84b commit 3c2a3bc

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

rdmo/accounts/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AdditionalFieldValueAdmin(admin.ModelAdmin):
1717

1818
@admin.register(ConsentFieldValue)
1919
class ConsentFieldValueAdmin(admin.ModelAdmin):
20-
readonly_fields = ('user', 'consent')
20+
readonly_fields = ('user', 'consent', 'updated', 'created')
2121

2222
def has_add_permission(self, request, obj=None):
2323
return False
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 4.2.17 on 2025-01-23 16:06
2+
3+
from django.db import migrations, models
4+
import django.utils.timezone
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('accounts', '0021_alter_help_text'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='consentfieldvalue',
16+
name='created',
17+
field=models.DateTimeField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
18+
preserve_default=False,
19+
),
20+
migrations.AddField(
21+
model_name='consentfieldvalue',
22+
name='updated',
23+
field=models.DateTimeField(default=django.utils.timezone.now, editable=False, verbose_name='updated'),
24+
preserve_default=False,
25+
),
26+
]

rdmo/accounts/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from django.dispatch import receiver
66
from django.utils.translation import gettext_lazy as _
77

8+
from rdmo.core.models import Model as RDMOTimeStampedModel
89
from rdmo.core.models import TranslationMixin
910

1011

@@ -106,7 +107,7 @@ def __str__(self):
106107
return self.user.username + '/' + self.field.key
107108

108109

109-
class ConsentFieldValue(models.Model):
110+
class ConsentFieldValue(RDMOTimeStampedModel):
110111

111112
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
112113
consent = models.BooleanField(

0 commit comments

Comments
 (0)