mirror of
https://github.com/jfmcbrayer/brutaldon
synced 2025-01-31 07:55:10 +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
97 lines
3.2 KiB
Python
97 lines
3.2 KiB
Python
from django import forms
|
|
from django.conf import settings
|
|
from django.utils.translation import gettext as _
|
|
from pytz import common_timezones
|
|
from .models import Theme, Preference
|
|
|
|
|
|
PRIVACY_CHOICES = (
|
|
("public", _("Public")),
|
|
("unlisted", _("Unlisted")),
|
|
("private", _("Private")),
|
|
("direct", _("Direct")),
|
|
)
|
|
|
|
timezones = [(tz, tz) for tz in common_timezones]
|
|
|
|
|
|
class LoginForm(forms.Form):
|
|
instance = forms.CharField(label=_("Instance"), max_length=256)
|
|
email = forms.EmailField(label=_("Email"))
|
|
password = forms.CharField(widget=forms.PasswordInput())
|
|
|
|
|
|
class OAuthLoginForm(forms.Form):
|
|
instance = forms.CharField(label=_("Instance"), max_length=256)
|
|
|
|
|
|
class PreferencesForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Preference
|
|
fields = [
|
|
"theme",
|
|
"filter_replies",
|
|
"filter_boosts",
|
|
"timezone",
|
|
"no_javascript",
|
|
"notifications",
|
|
"click_to_load",
|
|
"lightbox",
|
|
"filter_notifications",
|
|
"bundle_notifications",
|
|
"poll_frequency",
|
|
]
|
|
|
|
|
|
class PostForm(forms.Form):
|
|
"""def status_post(self, status, in_reply_to_id=None, media_ids=None,
|
|
sensitive=False, visibility=None, spoiler_text=None):"""
|
|
|
|
status = forms.CharField(label="Toot", widget=forms.Textarea)
|
|
visibility = forms.ChoiceField(
|
|
label=_("Toot visibility"), choices=PRIVACY_CHOICES, required=False
|
|
)
|
|
spoiler_text = forms.CharField(label=_("CW or Subject"), required=False)
|
|
media_file_1 = forms.FileField(label=_("Media 1"), required=False)
|
|
media_text_1 = forms.CharField(label=_("Describe media 1."), required=False)
|
|
media_file_2 = forms.FileField(label=_("Media 2"), required=False)
|
|
media_text_2 = forms.CharField(label=_("Describe media 2."), required=False)
|
|
media_file_3 = forms.FileField(label=_("Media 3"), required=False)
|
|
media_text_3 = forms.CharField(label=_("Describe media 3."), required=False)
|
|
media_file_4 = forms.FileField(label=_("Media 4"), required=False)
|
|
media_text_4 = forms.CharField(label=_("Describe media 4."), required=False)
|
|
media_sensitive = forms.BooleanField(label=_("Sensitive media?"), required=False)
|
|
|
|
|
|
class FilterForm(forms.Form):
|
|
phrase = forms.CharField(label=_("Word or phrase to filter"))
|
|
context_home = forms.BooleanField(
|
|
label=_("In home timeline"), required=False, initial=True
|
|
)
|
|
context_public = forms.BooleanField(
|
|
label=_("In public timelines"), required=False, initial=True
|
|
)
|
|
context_notes = forms.BooleanField(
|
|
label=_("In notifications"), required=False, initial=True
|
|
)
|
|
context_thread = forms.BooleanField(
|
|
label=_("In thread contexts"), required=False, initial=True
|
|
)
|
|
whole_word = forms.BooleanField(
|
|
label=_("Whole words only"), required=False, initial=True
|
|
)
|
|
expires_in = forms.TypedChoiceField(
|
|
label=_("Expires in"),
|
|
choices=(
|
|
("", "Never"),
|
|
("1800", "30 minutes"),
|
|
("3600", "1 hour"),
|
|
("21600", "6 hours"),
|
|
("43200", "12 hours"),
|
|
("86400", "1 day"),
|
|
("604800", "1 week"),
|
|
),
|
|
coerce=int,
|
|
required=False,
|
|
)
|