Merge branch 'django3' into 'master'

Django 3.1.1 bring up

See merge request allianceauth/allianceauth!1256
This commit is contained in:
Ariel Rin 2020-09-21 06:16:44 +00:00
commit 08a9bd42a3
54 changed files with 108 additions and 69 deletions

View File

@ -100,7 +100,7 @@ class UserProfileInline(admin.StackedInline):
formset.get_form_kwargs = get_kwargs
return formset
def has_add_permission(self, request):
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
@ -549,7 +549,7 @@ class PermissionAdmin(admin.ModelAdmin):
def admin_name(obj):
return str(obj)
def has_add_permission(self, request):
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):

View File

@ -1,6 +1,8 @@
from django import forms
from django.utils.translation import ugettext_lazy as _
from allianceauth.authentication.models import User
class RegistrationForm(forms.Form):
email = forms.EmailField(label=_('Email'), max_length=254, required=True)
class _meta:
model = User

View File

@ -10,5 +10,5 @@ urlpatterns = [
url(r'^register/$', views.RegistrationView.as_view(), name='registration_register'),
url(r'^register/complete/$', views.registration_complete, name='registration_complete'),
url(r'^register/closed/$', views.registration_closed, name='registration_disallowed'),
url(r'', include('registration.auth_urls')),
url(r'', include('django.contrib.auth.urls')),
]

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Dashboard" %}{% endblock %}

View File

@ -1,7 +1,7 @@
{% load staticfiles %}
{% extends 'public/base.html' %}
{% load static %}
{% load bootstrap %}
{% load i18n %}
{% extends 'public/base.html' %}
{% block page_title %}Registration{% endblock %}
{% block extra_include %}
{% include 'bundles/bootstrap-css.html' %}

View File

@ -6,7 +6,7 @@ from django.contrib.auth import login, authenticate
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core import signing
from django.urls import reverse
from django.urls import reverse, reverse_lazy
from django.shortcuts import redirect, render
from django.utils.translation import gettext_lazy as _
@ -14,12 +14,12 @@ from allianceauth.eveonline.models import EveCharacter
from esi.decorators import token_required
from esi.models import Token
from registration.backends.hmac.views import (
from django_registration.backends.activation.views import (
RegistrationView as BaseRegistrationView,
ActivationView as BaseActivationView,
REGISTRATION_SALT
)
from registration.signals import user_registered
from django_registration.signals import user_registered
from .models import CharacterOwnership
from .forms import RegistrationForm
@ -134,12 +134,10 @@ def sso_login(request, token):
# Step 2
class RegistrationView(BaseRegistrationView):
form_class = RegistrationForm
success_url = 'authentication:dashboard'
def get_success_url(self, user):
if not getattr(settings, 'REGISTRATION_VERIFY_EMAIL', True):
return 'authentication:dashboard', (), {}
return super().get_success_url(user)
template_name = "public/register.html"
email_body_template = "registration/activation_email.txt"
email_subject_template = "registration/activation_email_subject.txt"
success_url = reverse_lazy('registration_complete')
def dispatch(self, request, *args, **kwargs):
# We're storing a key in the session to pass user information from OAuth response. Make sure it's there.
@ -176,6 +174,9 @@ class RegistrationView(BaseRegistrationView):
# Step 3
class ActivationView(BaseActivationView):
template_name = "registration/activate.html"
success_url = reverse_lazy('registration_activation_complete')
def validate_key(self, activation_key):
try:
dump = signing.loads(activation_key, salt=REGISTRATION_SALT,

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Create Fatlink" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Fatlink view" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Personal fatlink statistics" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Personal fatlink statistics" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Fatlink Corp Statistics" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Fatlink statistics" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Fatlink view" %}{% endblock page_title %}

View File

@ -41,7 +41,7 @@ class AuthGroupInlineAdmin(admin.StackedInline):
kwargs["queryset"] = Group.objects.order_by(Lower('name'))
return super().formfield_for_manytomany(db_field, request, **kwargs)
def has_add_permission(self, request):
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.1 on 2020-09-18 14:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('groupmanagement', '0013_fix_requestlog_date_field'),
]
operations = [
migrations.AlterField(
model_name='requestlog',
name='request_type',
field=models.BooleanField(null=True),
),
]

View File

@ -25,7 +25,7 @@ class GroupRequest(models.Model):
class RequestLog(models.Model):
request_type = models.NullBooleanField(default=0)
request_type = models.BooleanField(null=True)
group = models.ForeignKey(Group, on_delete=models.CASCADE)
request_info = models.CharField(max_length=254)
action = models.BooleanField(default=0)

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{{ group }} {% trans "Audit Log" %}{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% load evelinks %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Groups Membership" %}{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Available Groups" %}{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% load evelinks %}

View File

@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% load navactive %}

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.1 on 2020-09-18 14:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrapplications', '0006_remove_legacy_models'),
]
operations = [
migrations.AlterField(
model_name='application',
name='approved',
field=models.BooleanField(blank=True, default=None, null=True),
),
]

View File

@ -35,7 +35,7 @@ class ApplicationForm(models.Model):
class Application(models.Model):
form = models.ForeignKey(ApplicationForm, on_delete=models.CASCADE, related_name='applications')
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='applications')
approved = models.NullBooleanField(blank=True, null=True, default=None)
approved = models.BooleanField(blank=True, null=True, default=None)
reviewer = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
reviewer_character = models.ForeignKey(EveCharacter, on_delete=models.SET_NULL, blank=True, null=True)
created = models.DateTimeField(auto_now_add=True)

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Choose a Corp" %}{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Apply To" %} {{ corp.corporation_name }}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "HR Application Management" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}HR Application Management{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load bootstrap %}
{% load i18n %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Notifications" %}{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "View Notification" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{{ permission.permission.codename }} - {% trans "Permissions Audit" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Permissions Overview" %}{% endblock page_title %}

View File

@ -211,6 +211,7 @@ class DiscordUser(models.Model):
Return None if user does no longer exist
"""
try:
_user = self.user
client = DiscordUser.objects._bot_client(is_rate_limited=is_rate_limited)
success = client.remove_guild_member(
guild_id=DISCORD_GUILD_ID, user_id=self.uid
@ -220,7 +221,7 @@ class DiscordUser(models.Model):
if deleted_count > 0:
if notify_user:
notify(
user=self.user,
user=_user,
title=gettext_lazy('Discord Account Disabled'),
message=gettext_lazy(
'Your Discord account was disabeled automatically '
@ -229,15 +230,15 @@ class DiscordUser(models.Model):
),
level='warning'
)
logger.info('Account for user %s was deleted.', self.user)
logger.info('Account for user %s was deleted.', _user)
return True
else:
logger.debug('Account for user %s was already deleted.', self.user)
logger.debug('Account for user %s was already deleted.', _user)
return None
else:
logger.warning(
'Failed to remove user %s from the Discord server', self.user
'Failed to remove user %s from the Discord server', _user
)
return False

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Jabber Broadcast" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Verify Teamspeak" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Fleet Formatter Tool" %}{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Credentials{% endblocktrans %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Password Change{% endblocktrans %}{% endblock page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Services Management" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "SRP Fleet Create" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% load humanize %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% load humanize %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "SRP Request" %}{% endblock page_title %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}{% trans "Update AAR Link" %}{% endblock page_title %}

View File

@ -35,7 +35,7 @@
{% if user.is_staff %}
<li><a href="{% url 'admin:index' %}">{% trans "Admin" %}</a></li>
{% endif %}
<li><a href="{% url 'auth_logout' %}">{% trans "Logout" %}</a></li>
<li><a href="{% url 'logout' %}">{% trans "Logout" %}</a></li>
{% else %}
<li><a href="{% url 'authentication:login' %}">{% trans "Login" %}</a></li>
{% endif %}

View File

@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
<!-- Bootstrap CSS -->
{% if NIGHT_MODE %}
{% if debug %}

View File

@ -1,6 +1,6 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% block page_title %}

View File

@ -1,5 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% load evelinks %}

View File

@ -22,12 +22,12 @@ install_requires = [
'celery>=4.3.0,<5.0.0,!=4.4.4', # 4.4.4 is missing a dependency
'celery_once',
'django>=2.2.1,<3.0',
'django>=3.1.1,<4.0.0',
'django-bootstrap-form',
'django-registration==2.4',
'django-registration>=3.1',
'django-sortedm2m',
'django-redis-cache>=2.1.0,<3.0.0',
'django-celery-beat>=1.1.1,<2.0.0',
'django-celery-beat>=2.0.0',
'openfire-restapi',
'sleekxmpp',

View File

@ -13,7 +13,6 @@ basepython =
py38: python3.8
deps=
coverage
Django>=2.0,<3.0
install_command = pip install -e ".[testing]" -U {opts} {packages}
commands =
all: coverage run runtests.py -v 2