Add: post seen option for users profiles
This commit is contained in:
parent
132d69b506
commit
79012429fb
2 changed files with 9 additions and 1 deletions
|
@ -5,7 +5,7 @@ from .models import UserProfile
|
||||||
class UserProfileForm(forms.ModelForm):
|
class UserProfileForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = UserProfile
|
model = UserProfile
|
||||||
fields = ['show_mature', "items_per_page"]
|
fields = ['show_mature', "items_per_page", "post_seen_delay"]
|
||||||
|
|
||||||
class UserForm(forms.ModelForm):
|
class UserForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -19,9 +19,17 @@ class UserProfile(models.Model):
|
||||||
(72, "72"),
|
(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)
|
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])
|
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])
|
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:
|
class Meta:
|
||||||
verbose_name = _("User Profile")
|
verbose_name = _("User Profile")
|
||||||
|
|
Loading…
Reference in a new issue