2018-04-24 00:16:22 +02:00
|
|
|
from django import forms
|
2018-08-02 17:13:50 +02:00
|
|
|
from django.conf import settings
|
2018-08-21 19:15:10 +02:00
|
|
|
from pytz import common_timezones
|
2018-08-28 18:22:20 +02:00
|
|
|
from .models import Theme, Preference
|
|
|
|
|
2018-04-24 00:16:22 +02:00
|
|
|
|
2018-05-22 15:41:11 +02:00
|
|
|
PRIVACY_CHOICES = (('public', 'Public'),
|
2018-04-27 20:12:29 +02:00
|
|
|
('unlisted', 'Unlisted'),
|
|
|
|
('private', 'Private'),
|
|
|
|
('direct', 'Direct'))
|
|
|
|
|
2018-08-21 19:15:10 +02:00
|
|
|
timezones = [ (tz, tz) for tz in common_timezones]
|
|
|
|
|
2018-04-24 00:16:22 +02:00
|
|
|
class LoginForm(forms.Form):
|
|
|
|
instance = forms.CharField(label="Instance",
|
|
|
|
max_length=256)
|
2018-08-28 18:22:20 +02:00
|
|
|
email = forms.EmailField(label="Email")
|
2018-04-24 00:16:22 +02:00
|
|
|
password = forms.CharField(widget=forms.PasswordInput())
|
|
|
|
|
2018-05-14 21:35:10 +02:00
|
|
|
class OAuthLoginForm(forms.Form):
|
|
|
|
instance = forms.CharField(label="Instance",
|
|
|
|
max_length=256)
|
|
|
|
|
2018-08-28 18:22:20 +02:00
|
|
|
class PreferencesForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Preference
|
|
|
|
fields = ['theme', 'filter_replies', 'filter_boosts', 'timezone']
|
2018-04-27 20:12:29 +02:00
|
|
|
|
|
|
|
class PostForm(forms.Form):
|
|
|
|
"""def status_post(self, status, in_reply_to_id=None, media_ids=None,
|
2018-08-02 17:13:50 +02:00
|
|
|
sensitive=False, visibility=None, spoiler_text=None):"""
|
2018-09-05 01:19:35 +02:00
|
|
|
status = forms.CharField(label="Toot", widget=forms.Textarea)
|
2018-05-22 14:57:45 +02:00
|
|
|
visibility = forms.ChoiceField(label="Toot visibility", choices=PRIVACY_CHOICES,
|
|
|
|
required=False)
|
2018-09-05 01:19:35 +02:00
|
|
|
spoiler_text = forms.CharField(label="CW or Subject",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_file_1 = forms.FileField(label = "Media 1",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_text_1 = forms.CharField(label="Describe media 1.",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_file_2 = forms.FileField(label = "Media 2",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_text_2 = forms.CharField(label="Describe media 2.",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_file_3 = forms.FileField(label = "Media 3",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_text_3 = forms.CharField(label="Describe media 3.",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_file_4 = forms.FileField(label = "Media 4",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
2018-08-28 18:29:16 +02:00
|
|
|
media_text_4 = forms.CharField(label="Describe media 4.",
|
2018-04-30 14:58:10 +02:00
|
|
|
required=False)
|
|
|
|
media_sensitive = forms.BooleanField(label="Sensitive media?", required=False)
|