From 79012429fbf7df9904ec8693b9c3ec137ac745dc Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Sun, 17 Nov 2024 22:09:30 +0100 Subject: [PATCH] Add: post seen option for users profiles --- archivist/apps/user/forms.py | 2 +- archivist/apps/user/models.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/archivist/apps/user/forms.py b/archivist/apps/user/forms.py index fd748d5..0f67957 100644 --- a/archivist/apps/user/forms.py +++ b/archivist/apps/user/forms.py @@ -5,7 +5,7 @@ from .models import UserProfile class UserProfileForm(forms.ModelForm): class Meta: model = UserProfile - fields = ['show_mature', "items_per_page"] + fields = ['show_mature', "items_per_page", "post_seen_delay"] class UserForm(forms.ModelForm): class Meta: diff --git a/archivist/apps/user/models.py b/archivist/apps/user/models.py index 46b4566..5b9154b 100644 --- a/archivist/apps/user/models.py +++ b/archivist/apps/user/models.py @@ -19,9 +19,17 @@ class UserProfile(models.Model): (72, "72"), ] + POST_SEEN_DELAY = [ + (15, "15"), + (30, "30"), + (60, "60"), + (90, "90"), + ] + user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True, unique=True) show_mature = models.CharField(max_length=2, choices=MATURE, default=MATURE[0][0]) items_per_page = models.IntegerField(choices=ITEMS_PER_PAGE, default=ITEMS_PER_PAGE[0][0]) + post_seen_delay = models.IntegerField(choices=POST_SEEN_DELAY, default=POST_SEEN_DELAY[1][1], help_text="Delay in seconds before marking a post as seen") class Meta: verbose_name = _("User Profile")