Apply isort to entire codebase

parent 8aacf7db
[settings]
skip=migrations
multi_line_output=0
balanced_wrapping=True
known_third_party=django,rest_framework,sendfile,bs4,django_ical,bleach,factory,faker,requests
from django.contrib import admin
from utils.translation import TranslatedModelAdmin
from . import models
......
......@@ -2,14 +2,15 @@ import datetime
import logging
from django.contrib.auth.models import Permission
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.core.validators import MinValueValidator
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from members.models import Member
from utils.translation import MultilingualField, ModelTranslateMeta
from utils.translation import ModelTranslateMeta, MultilingualField
logger = logging.getLogger(__name__)
......
from django.core.exceptions import ValidationError
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils import timezone
......
from django.shortcuts import render, get_object_or_404
from django.shortcuts import get_object_or_404, render
from .models import Committee, CommitteeMembership, Board
from .models import Board, Committee, CommitteeMembership
def committee_index(request):
......
from django.contrib import admin
from documents.models import AssociationDocumentsYear
from documents.models import MiscellaneousDocument
from documents.models import GeneralMeeting, GeneralMeetingDocument
from documents.models import (AssociationDocumentsYear, GeneralMeeting,
GeneralMeetingDocument, MiscellaneousDocument)
class GeneralMeetingDocInline(admin.StackedInline):
......
import os
import requests
from bs4 import BeautifulSoup
from django.core.files.base import ContentFile
from django.utils import timezone
from django.utils.timezone import datetime
from documents.models import (AssociationDocumentsYear, GeneralMeeting,
GeneralMeetingDocument, MiscellaneousDocument)
from utils.management.commands import legacylogin
from documents.models import (
GeneralMeeting,
GeneralMeetingDocument,
AssociationDocumentsYear,
MiscellaneousDocument
)
from bs4 import BeautifulSoup
import requests
import os
def filefield_from_url(filefield, url):
......
from django.db import models
from django.utils import timezone
from django.core.validators import MinValueValidator
from django.db import models
from django.urls import reverse
from django.utils import timezone
from utils.validators import validate_file_extension
......
from django import template
import os
from django import template
register = template.Library()
......
......@@ -5,9 +5,10 @@ from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, render
from django.utils import timezone
from django.utils.text import slugify
from documents.models import AssociationDocumentsYear, MiscellaneousDocument
from documents.models import GeneralMeeting, GeneralMeetingDocument
from sendfile import sendfile
from documents.models import (AssociationDocumentsYear, GeneralMeeting,
GeneralMeetingDocument, MiscellaneousDocument)
from utils.snippets import datetime_to_lectureyear
......
......@@ -3,6 +3,7 @@ This module registers admin pages for the models
"""
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from utils.translation import TranslatedModelAdmin
from . import models
......
from django.conf import settings
from django.forms import (
ModelForm,
DateField,
SelectDateWidget,
ModelChoiceField,
ChoiceField
)
from django.forms import (ChoiceField, DateField, ModelChoiceField,
ModelForm, SelectDateWidget)
from .models import Exam, Summary, Course
from .models import Course, Exam, Summary
class AddExamForm(ModelForm):
......
......@@ -4,11 +4,12 @@ import os
import requests
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied, ImproperlyConfigured
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.core.files.base import ContentFile
from django.utils.dateparse import parse_date
from django.utils.translation import activate
from education.models import Summary, Exam, Course, Category
from education.models import Category, Course, Exam, Summary
from utils.management.commands import legacylogin
......
......@@ -3,8 +3,9 @@ from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from utils.snippets import datetime_to_lectureyear
from utils.translation import MultilingualField, ModelTranslateMeta
from utils.translation import ModelTranslateMeta, MultilingualField
class Category(models.Model, metaclass=ModelTranslateMeta):
......
import os
import itertools
import os
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404
from django.shortcuts import get_object_or_404, render
from django.utils.translation import ugettext_lazy as _
from sendfile import sendfile
......
# -*- coding: utf-8 -*-
from activemembers.models import Committee
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.urls import reverse
......@@ -7,11 +6,12 @@ from django.utils import timezone
from django.utils.html import format_html
from django.utils.http import is_safe_url
from django.utils.translation import ugettext_lazy as _
from activemembers.models import Committee
from members.models import Member
from utils.translation import TranslatedModelAdmin
from . import forms
from . import models
from . import forms, models
def _do_next(request, response):
......
from django.utils import timezone
from django.urls import reverse
from django.utils import timezone
from rest_framework import serializers
from events.models import Event
......
from datetime import datetime
from django.utils import timezone
from rest_framework import viewsets
from rest_framework.exceptions import ParseError
from rest_framework.response import Response
from django.utils import timezone
from datetime import datetime
from events.api.serializers import EventSerializer
from events.models import Event
......
from datetime import datetime, timedelta
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import activate
from django_ical.views import ICalFeed
from events.models import Event
from django.utils.translation import ugettext as _
class EventFeed(ICalFeed):
......
from django import forms
from django.utils.translation import get_language, ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import get_language
from .models import RegistrationInformationField
......
import re
import json
import requests
from django.contrib.auth.models import User
import re
from datetime import datetime
from django.core.management.base import BaseCommand
import requests
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.utils import timezone
import events.models as events_models
import members.models as members_models
FIELD_DATA_TYPES = {
'0': events_models.RegistrationInformationField.TEXT_FIELD,
'1': events_models.RegistrationInformationField.INTEGER_FIELD,
......
......@@ -4,8 +4,10 @@ from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _, string_concat
from utils.translation import MultilingualField, ModelTranslateMeta
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from utils.translation import ModelTranslateMeta, MultilingualField
class Event(models.Model, metaclass=ModelTranslateMeta):
......
......@@ -4,9 +4,8 @@ from django.core.exceptions import ValidationError
from django.test import TestCase
from django.utils import timezone
from members.models import Member
from events.models import Event, Registration
from members.models import Member
class RegistrationTest(TestCase):
......
......@@ -5,6 +5,7 @@ Events URL Configuration
from django.conf.urls import url
from events.feeds import EventFeed
from . import views
urlpatterns = [
......
......@@ -2,18 +2,19 @@ import csv
import json
from datetime import timedelta
from django.http import HttpResponse, JsonResponse
from django.views.decorators.http import require_http_methods
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import permission_required, login_required
from django.contrib.auth.decorators import login_required, permission_required
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import pgettext_lazy
from django.views.decorators.http import require_http_methods
from .models import Event, Registration, RegistrationInformationField
from .forms import FieldsForm
from .models import Event, Registration, RegistrationInformationField
@staff_member_required
......
from django.contrib import admin
from .models import MailingList, VerbatimAddress, ListAlias
from .models import ListAlias, MailingList, VerbatimAddress
class VerbatimAddressInline(admin.TabularInline):
......
import requests
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from activemembers.models import Committee, Board
from members.models import Member
from activemembers.models import Board, Committee
from mailinglists.models import MailingList, VerbatimAddress
import requests
from members.models import Member
class Command(BaseCommand):
......
from django.db import models
from django.core import validators
from django.db import models
from django.utils.translation import ugettext_lazy as _
from members.models import Member
from activemembers.models import Committee
from members.models import Member
class MailingList(models.Model):
......
import hashlib
from django.core.exceptions import PermissionDenied
from django.shortcuts import render, get_object_or_404
from django.http import Http404
from django.shortcuts import get_object_or_404, render
from .models import MailingList
from members.models import Member
from activemembers.models import CommitteeMembership
from members.models import Member
from .models import MailingList
import hashlib
# Consider replacing this completely;
# - either by a cronjob Python script that queries the database directly
......
......@@ -5,11 +5,11 @@ import datetime
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm as BaseUserCreationForm
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from . import models, forms
from . import forms, models
class MembershipInline(admin.StackedInline):
......
import copy
from datetime import datetime
from django.utils import timezone
from rest_framework import viewsets
from rest_framework.decorators import list_route
from datetime import datetime
import copy
from rest_framework.exceptions import ParseError
from rest_framework.response import Response
......
......@@ -4,7 +4,8 @@ from django import forms
from django.contrib.auth.models import User
from django.template import loader
from django.utils import translation
from django.utils.translation import ugettext_lazy as _, ugettext as t
from django.utils.translation import ugettext as t
from django.utils.translation import ugettext_lazy as _
from .models import Member
......
from django.core.files.base import ContentFile
import json
import os
import requests
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.utils.dateparse import parse_date
from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from django.utils.dateparse import parse_date
from django.utils.translation import activate
from activemembers.models import (Board, Committee, CommitteeMembership,
Mentorship)
from activemembers.models import (Board, Committee,
CommitteeMembership, Mentorship)
from members.models import Member
from bs4 import BeautifulSoup
import requests
import json
import os
def imagefield_from_url(imagefield, url):
file = ContentFile(requests.get(url).content)
......
from django.utils import timezone
import operator
from datetime import date, timedelta
from functools import reduce
from django.conf import settings
from django.core import validators
from django.db import models
from django.db.models import Q
from django.core import validators
from django.conf import settings
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from datetime import timedelta, date
import operator
from functools import reduce
from localflavor.generic.countries.sepa import IBAN_SEPA_COUNTRIES
from localflavor.generic.models import IBANField
......
from datetime import datetime, date, timedelta
from datetime import date, datetime, timedelta
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from django.contrib.auth.models import User
from members.models import (Member, Membership,
gen_stats_year, gen_stats_member_type)
gen_stats_member_type, gen_stats_year)
class MemberBirthdayTest(TestCase):
......
......@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
urlpatterns = [
url('^become-a-member-document/(?P<pk>[0-9]*)', views.get_become_a_member_document, name='become-a-member-document'),
url('^profile/(?P<pk>[0-9]*)$', views.profile, name='profile'),
......
import json
import os
from datetime import date, datetime
from sendfile import sendfile
import json
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db.models import Q
from django.shortcuts import get_object_or_404, render
from django.contrib.auth.decorators import login_required
from django.utils.text import slugify
from sendfile import sendfile
from . import models
from .forms import MemberForm
......
from django.contrib import admin
from utils.translation import TranslatedModelAdmin
from .models import MerchandiseItem
......
import os
from decimal import Decimal
import requests
from bs4 import BeautifulSoup
from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
from decimal import Decimal
from merchandise.models import MerchandiseItem
from bs4 import BeautifulSoup
import requests
import os
def filefield_from_url(filefield, url):
file = ContentFile(requests.get(url).content)
......
from django.db import models
from utils.translation import MultilingualField, ModelTranslateMeta
from utils.translation import ModelTranslateMeta, MultilingualField
class MerchandiseItem(models.Model, metaclass=ModelTranslateMeta):
......
from django.contrib import admin
from django.shortcuts import redirect
from newsletters.models import Newsletter, NewsletterEvent, NewsletterItem
from utils.translation import TranslatedModelAdmin
from newsletters.models import (
Newsletter,
NewsletterEvent,
NewsletterItem
)
class NewsletterItemInline(admin.StackedInline):
model = NewsletterItem
......
......@@ -3,7 +3,8 @@ from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from tinymce.models import HTMLField
from utils.translation import MultilingualField, ModelTranslateMeta
from utils.translation import ModelTranslateMeta, MultilingualField
class Newsletter(models.Model, metaclass=ModelTranslateMeta):
......
......@@ -5,6 +5,7 @@ from django.core.exceptions import ValidationError
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from newsletters.models import Newsletter, NewsletterEvent
......
......@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
urlpatterns = [
url('^(?P<pk>\d+)/$', views.preview, name='preview'),
url(r'admin/send/(?P<pk>\d+)/$', views.admin_send, name='admin-send'),
......
......@@ -2,10 +2,11 @@ from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required, permission_required
from django.core.mail import EmailMultiAlternatives
from django.shortcuts import get_object_or_404, render, redirect
from django.shortcuts import get_object_or_404, redirect, render
from django.template import Context
from django.template.loader import get_template
from django.utils import translation
from members.models import Member
from newsletters.models import Newsletter
from partners.models import Partner
......
from django.contrib import admin
from partners.models import (Partner, PartnerEvent, PartnerImage,
Vacancy, VacancyCategory)
from utils.translation import TranslatedModelAdmin
from partners.models import (