Display date_added in bookmark list (#85)

* Display date_added in bookmark list (#85)

* Allow switching between different types of date formats

* Improve date formatting

* Use pluralize

* Fix comment

* Fix styles

Co-authored-by: Sascha Ißbrücker <sissbruecker@lyska.io>
This commit is contained in:
Sascha Ißbrücker
2021-03-31 09:08:19 +02:00
committed by GitHub
parent 8dd1575dc6
commit 7a68a4abed
15 changed files with 226 additions and 9 deletions

View File

@@ -107,14 +107,24 @@ class UserProfile(models.Model):
(THEME_LIGHT, 'Light'),
(THEME_DARK, 'Dark'),
]
BOOKMARK_DATE_DISPLAY_RELATIVE = 'relative'
BOOKMARK_DATE_DISPLAY_ABSOLUTE = 'absolute'
BOOKMARK_DATE_DISPLAY_HIDDEN = 'hidden'
BOOKMARK_DATE_DISPLAY_CHOICES = [
(BOOKMARK_DATE_DISPLAY_RELATIVE, 'Relative'),
(BOOKMARK_DATE_DISPLAY_ABSOLUTE, 'Absolute'),
(BOOKMARK_DATE_DISPLAY_HIDDEN, 'Hidden'),
]
user = models.OneToOneField(get_user_model(), related_name='profile', on_delete=models.CASCADE)
theme = models.CharField(max_length=10, choices=THEME_CHOICES, blank=False, default=THEME_AUTO)
bookmark_date_display = models.CharField(max_length=10, choices=BOOKMARK_DATE_DISPLAY_CHOICES, blank=False,
default=BOOKMARK_DATE_DISPLAY_RELATIVE)
class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ['theme']
fields = ['theme', 'bookmark_date_display']
@receiver(post_save, sender=get_user_model())