From 2166d06d44edc143786cfc576ac16c6049e5616c Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Tue, 11 Oct 2022 16:23:46 -0400 Subject: [PATCH] Use ModelWithCreatedUpdatedFields for Profile model this adds the fields `created_at`, `created_by`, `updated_at` and `updated_by` --- profile/models.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/profile/models.py b/profile/models.py index a33391cc..2faa9788 100644 --- a/profile/models.py +++ b/profile/models.py @@ -20,19 +20,15 @@ from django.contrib.auth.models import User from django.db import models from django.utils.translation import gettext_lazy as _ +from program.models import ModelWithCreatedUpdatedFields -class Profile(models.Model): +class Profile(ModelWithCreatedUpdatedFields, models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, related_name="profile", editable=False ) cba_username = models.CharField(_("CBA Username"), blank=True, max_length=60) cba_user_token = models.CharField(_("CBA Token"), blank=True, max_length=255) - # FIXME: these fields should be from an abstract model - created_at = models.DateTimeField(auto_now_add=True) - created_by = models.CharField(max_length=150) - updated_at = models.DateTimeField(auto_now=True) - updated_by = models.CharField(max_length=150) def __str__(self): return self.user.username -- GitLab