diff options
author | 2020-07-15 12:31:18 +0200 | |
---|---|---|
committer | 2020-07-15 12:31:18 +0200 | |
commit | 0f99bf948b5d2a4fdd3a938ed8c5a6b628fe58d8 (patch) | |
tree | 77008b8fc0b0546b7a78f23d6ea77b2f1b948047 /pydis_site | |
parent | Add the AllowList model and serializer. (diff) | |
parent | Merge pull request #346 from python-discord/feat/deps/344/django-3.0 (diff) |
Merge branch 'master' into whitelist_system
Diffstat (limited to 'pydis_site')
-rw-r--r-- | pydis_site/apps/api/migrations/0051_allow_blank_message_embeds.py | 21 | ||||
-rw-r--r-- | pydis_site/apps/api/migrations/0055_merge_20200714_2027.py | 14 | ||||
-rw-r--r-- | pydis_site/apps/api/migrations/0056_allow_blank_user_roles.py | 21 | ||||
-rw-r--r-- | pydis_site/apps/api/models/bot/message.py | 1 | ||||
-rw-r--r-- | pydis_site/apps/api/models/bot/user.py | 1 | ||||
-rw-r--r-- | pydis_site/apps/api/urls.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/home/forms/account_deletion.py | 14 | ||||
-rw-r--r-- | pydis_site/settings.py | 16 | ||||
-rw-r--r-- | pydis_site/templates/home/account/delete.html | 9 |
9 files changed, 67 insertions, 32 deletions
diff --git a/pydis_site/apps/api/migrations/0051_allow_blank_message_embeds.py b/pydis_site/apps/api/migrations/0051_allow_blank_message_embeds.py new file mode 100644 index 00000000..e617e1c9 --- /dev/null +++ b/pydis_site/apps/api/migrations/0051_allow_blank_message_embeds.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.4 on 2020-03-21 17:05 + +import django.contrib.postgres.fields +import django.contrib.postgres.fields.jsonb +from django.db import migrations +import pydis_site.apps.api.models.bot.tag + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0050_remove_infractions_active_default_value'), + ] + + operations = [ + migrations.AlterField( + model_name='deletedmessage', + name='embeds', + field=django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.jsonb.JSONField(validators=[pydis_site.apps.api.models.bot.tag.validate_tag_embed]), blank=True, help_text='Embeds attached to this message.', size=None), + ), + ] diff --git a/pydis_site/apps/api/migrations/0055_merge_20200714_2027.py b/pydis_site/apps/api/migrations/0055_merge_20200714_2027.py new file mode 100644 index 00000000..f2a0e638 --- /dev/null +++ b/pydis_site/apps/api/migrations/0055_merge_20200714_2027.py @@ -0,0 +1,14 @@ +# Generated by Django 3.0.8 on 2020-07-14 20:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0051_allow_blank_message_embeds'), + ('api', '0054_user_invalidate_unknown_role'), + ] + + operations = [ + ] diff --git a/pydis_site/apps/api/migrations/0056_allow_blank_user_roles.py b/pydis_site/apps/api/migrations/0056_allow_blank_user_roles.py new file mode 100644 index 00000000..489941c7 --- /dev/null +++ b/pydis_site/apps/api/migrations/0056_allow_blank_user_roles.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.8 on 2020-07-14 20:35 + +import django.contrib.postgres.fields +import django.core.validators +from django.db import migrations, models +import pydis_site.apps.api.models.bot.user + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0055_merge_20200714_2027'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='roles', + field=django.contrib.postgres.fields.ArrayField(base_field=models.BigIntegerField(validators=[django.core.validators.MinValueValidator(limit_value=0, message='Role IDs cannot be negative.'), pydis_site.apps.api.models.bot.user._validate_existing_role]), blank=True, default=list, help_text='IDs of roles the user has on the server', size=None), + ), + ] diff --git a/pydis_site/apps/api/models/bot/message.py b/pydis_site/apps/api/models/bot/message.py index 7694ac75..78dcbf1d 100644 --- a/pydis_site/apps/api/models/bot/message.py +++ b/pydis_site/apps/api/models/bot/message.py @@ -49,6 +49,7 @@ class Message(ModelReprMixin, models.Model): pgfields.JSONField( validators=(validate_tag_embed,) ), + blank=True, help_text="Embeds attached to this message." ) attachments = pgfields.ArrayField( diff --git a/pydis_site/apps/api/models/bot/user.py b/pydis_site/apps/api/models/bot/user.py index d7f203aa..cd2d58b9 100644 --- a/pydis_site/apps/api/models/bot/user.py +++ b/pydis_site/apps/api/models/bot/user.py @@ -52,6 +52,7 @@ class User(ModelReprMixin, models.Model): ) ), default=list, + blank=True, help_text="IDs of roles the user has on the server" ) in_guild = models.BooleanField( diff --git a/pydis_site/apps/api/urls.py b/pydis_site/apps/api/urls.py index 4a0281b4..3bb5198e 100644 --- a/pydis_site/apps/api/urls.py +++ b/pydis_site/apps/api/urls.py @@ -41,7 +41,7 @@ bot_router.register( bot_router.register( 'off-topic-channel-names', OffTopicChannelNameViewSet, - base_name='offtopicchannelname' + basename='offtopicchannelname' ) bot_router.register( 'reminders', diff --git a/pydis_site/apps/home/forms/account_deletion.py b/pydis_site/apps/home/forms/account_deletion.py index 17ffe5c1..eec70bea 100644 --- a/pydis_site/apps/home/forms/account_deletion.py +++ b/pydis_site/apps/home/forms/account_deletion.py @@ -1,23 +1,9 @@ -from crispy_forms.helper import FormHelper -from crispy_forms.layout import Layout from django.forms import CharField, Form -from django_crispy_bulma.layout import IconField, Submit class AccountDeletionForm(Form): """Account deletion form, to collect username for confirmation of removal.""" - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.helper = FormHelper() - - self.helper.form_method = "post" - self.helper.add_input(Submit("submit", "I understand, delete my account")) - - self.helper.layout = Layout( - IconField("username", icon_prepend="user") - ) - username = CharField( label="Username", required=True diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 5f80a414..2c87007c 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -52,6 +52,8 @@ if DEBUG: 'api.pythondiscord.local', 'admin.pythondiscord.local', 'staff.pythondiscord.local', + '0.0.0.0', # noqa: S104 + 'localhost', 'web', 'api.web', 'admin.web', @@ -104,8 +106,6 @@ INSTALLED_APPS = [ 'allauth.socialaccount.providers.discord', 'allauth.socialaccount.providers.github', - 'crispy_forms', - 'django_crispy_bulma', 'django_hosts', 'django_filters', 'django_nyt.apps.DjangoNytConfig', @@ -288,7 +288,6 @@ LOGGING = { } # Django Messages framework config - MESSAGE_TAGS = { messages.DEBUG: 'primary', messages.INFO: 'info', @@ -297,17 +296,6 @@ MESSAGE_TAGS = { messages.ERROR: 'danger', } -# Custom settings for Crispyforms -CRISPY_ALLOWED_TEMPLATE_PACKS = ( - "bootstrap", - "uni_form", - "bootstrap3", - "bootstrap4", - "bulma", -) - -CRISPY_TEMPLATE_PACK = "bulma" - # Custom settings for django-simple-bulma BULMA_SETTINGS = { "variables": { # If you update these colours, please update the notification.css file diff --git a/pydis_site/templates/home/account/delete.html b/pydis_site/templates/home/account/delete.html index 1020a82b..0d44e32a 100644 --- a/pydis_site/templates/home/account/delete.html +++ b/pydis_site/templates/home/account/delete.html @@ -1,6 +1,4 @@ {% extends 'base/base.html' %} - -{% load crispy_forms_tags %} {% load static %} {% block title %}Delete Account{% endblock %} @@ -36,7 +34,12 @@ <div class="columns is-centered"> <div class="column is-half-desktop is-full-tablet is-full-mobile"> - {% crispy form %} + <form method="post"> + {% csrf_token %} + <label for="id_username" class="label requiredField">Username</label> + <input id="id_username" class="input" type="text" required name="username"> + <input style="margin-top: 1em;" type="submit" value="I understand, delete my account" class="button is-primary"> + </form> </div> </div> </div> |