mirror of
https://github.com/jfmcbrayer/brutaldon
synced 2025-01-21 19:35:59 +01:00
cf13ad3790
commit 0a80206abb8fae7785a59aab88043b2b1974756b Author: Jason McBrayer <jmcbray@carcosa.net> Date: Tue Nov 5 19:22:00 2019 -0500 Fix oxford comma in bundled notifications, remove unused dependency commit e96bd22bdce996734aaaf1d5625e08add3c8fcf7 Author: Jason McBrayer <jmcbray@carcosa.net> Date: Tue Nov 5 19:19:42 2019 -0500 Now template works with bundled or un-bundled notifications commit 6f46bef7fdd0defe2f02e09e28558de882ce4456 Author: Jason McBrayer <jmcbray@carcosa.net> Date: Tue Nov 5 19:02:51 2019 -0500 Bundled toots work; now fix unbundled case commit 07d9de49f943d019d04a5a5203081e57dc0741d8 Author: Jason McBrayer <jmcbray@carcosa.net> Date: Tue Nov 5 14:09:14 2019 -0500 Notifications are now sorted by groups, but not collapsed commit f62666929f12cf0c7db4c68a1468f7e138318a5c Author: Jason McBrayer <jmcbray@carcosa.net> Date: Tue Nov 5 13:58:41 2019 -0500 Fix saving of bundle_notifications setting commit 335d5f985c968bb84e4b459dabf77d1d7ecad646 Author: Jason McBrayer <jmcbray@carcosa.net> Date: Mon Nov 4 18:57:54 2019 -0500 Forgot to include migration for bundle notifications preference commit 0e8232591c4f1bb972e9694433c546c9f66b5419 Author: Jason McBrayer <jmcbray@carcosa.net> Date: Mon Nov 4 18:57:35 2019 -0500 Bundle notifications setting front-end commit 6e945f1ceb2ff19470e164a946a6a48de4142812 Author: Jason McBrayer <jmcbray@carcosa.net> Date: Mon Nov 4 18:54:49 2019 -0500 Backend code to group notifications
84 lines
3.1 KiB
Python
84 lines
3.1 KiB
Python
from django.db import models
|
|
from django.conf import settings
|
|
from django.utils.translation import gettext as _
|
|
from pytz import common_timezones
|
|
|
|
timezones = [(tz, tz) for tz in common_timezones]
|
|
|
|
|
|
class Client(models.Model):
|
|
name = models.CharField(default="brutaldon", max_length=80)
|
|
api_base_id = models.URLField(default="https://mastodon.social")
|
|
version = models.CharField(default="1.0", max_length=80)
|
|
client_id = models.CharField(null=True, blank=True, max_length=2048)
|
|
client_secret = models.CharField(null=True, blank=True, max_length=2048)
|
|
|
|
def __str__(self):
|
|
return self.name + ": " + self.api_base_id
|
|
|
|
|
|
class Theme(models.Model):
|
|
name = models.CharField(max_length=80, unique=True)
|
|
prefix = models.CharField(max_length=40, null=True, default="default")
|
|
main_css = models.CharField(
|
|
max_length=1024, blank=True, null=True, default="css/fullbrutalism.css"
|
|
)
|
|
tweaks_css = models.CharField(max_length=1024, blank=True, null=True)
|
|
is_brutalist = models.BooleanField(default=False)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class Preference(models.Model):
|
|
theme = models.ForeignKey(Theme, models.CASCADE, null=False, default=1)
|
|
filter_replies = models.BooleanField(default=False)
|
|
filter_boosts = models.BooleanField(default=False)
|
|
timezone = models.CharField(
|
|
max_length=80, blank=True, null=True, choices=timezones, default="UTC"
|
|
)
|
|
no_javascript = models.BooleanField(
|
|
default=False,
|
|
help_text=_(
|
|
"""Disable all JavaScript. Overrides all other JavaScript options."""
|
|
),
|
|
)
|
|
notifications = models.BooleanField(
|
|
default=True, help_text=_("""Display live notifications in header.""")
|
|
)
|
|
click_to_load = models.BooleanField(
|
|
default=False,
|
|
help_text=_(
|
|
"""Click to load more toots in the same page, rather than using pagination."""
|
|
),
|
|
)
|
|
lightbox = models.BooleanField(
|
|
default=False, help_text=_("""Use a JavaScript lightbox to display media.""")
|
|
)
|
|
poll_frequency = models.IntegerField(
|
|
default=300,
|
|
help_text=_(
|
|
"""Number of seconds to wait between checking notifications. Default: 300"""
|
|
),
|
|
)
|
|
filter_notifications = models.BooleanField(
|
|
default=False,
|
|
help_text=_("""Exclude boosts and favs from your notifications."""),
|
|
)
|
|
bundle_notifications = models.BooleanField(
|
|
default=False,
|
|
help_text=_(
|
|
"""Collapse together boosts or likes of the same toot in the notifications page."""
|
|
),
|
|
)
|
|
|
|
|
|
class Account(models.Model):
|
|
username = models.EmailField(unique=True)
|
|
email = models.EmailField(null=True, blank=True)
|
|
django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True)
|
|
access_token = models.CharField(null=True, blank=True, max_length=2048)
|
|
client = models.ForeignKey(Client, models.SET_NULL, null=True)
|
|
preferences = models.ForeignKey(Preference, models.SET_NULL, null=True)
|
|
note_seen = models.CharField(null=True, blank=True, max_length=128)
|