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 django.contrib import admin
from utils.translation import TranslatedModelAdmin from utils.translation import TranslatedModelAdmin
from . import models from . import models
......
...@@ -2,14 +2,15 @@ import datetime ...@@ -2,14 +2,15 @@ import datetime
import logging import logging
from django.contrib.auth.models import Permission 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.core.validators import MinValueValidator
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from members.models import Member from members.models import Member
from utils.translation import MultilingualField, ModelTranslateMeta from utils.translation import ModelTranslateMeta, MultilingualField
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
from django.core.exceptions import ValidationError
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError from django.db.utils import IntegrityError
from django.test import TestCase from django.test import TestCase
from django.utils import timezone 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): def committee_index(request):
......
from django.contrib import admin from django.contrib import admin
from documents.models import AssociationDocumentsYear from documents.models import (AssociationDocumentsYear, GeneralMeeting,
from documents.models import MiscellaneousDocument GeneralMeetingDocument, MiscellaneousDocument)
from documents.models import GeneralMeeting, GeneralMeetingDocument
class GeneralMeetingDocInline(admin.StackedInline): class GeneralMeetingDocInline(admin.StackedInline):
......
import os
import requests
from bs4 import BeautifulSoup
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
from django.utils import timezone from django.utils import timezone
from django.utils.timezone import datetime from django.utils.timezone import datetime
from documents.models import (AssociationDocumentsYear, GeneralMeeting,
GeneralMeetingDocument, MiscellaneousDocument)
from utils.management.commands import legacylogin 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): def filefield_from_url(filefield, url):
......
from django.db import models
from django.utils import timezone
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone
from utils.validators import validate_file_extension from utils.validators import validate_file_extension
......
from django import template
import os import os
from django import template
register = template.Library() register = template.Library()
......
...@@ -5,9 +5,10 @@ from django.core.exceptions import PermissionDenied ...@@ -5,9 +5,10 @@ from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
from django.utils import timezone from django.utils import timezone
from django.utils.text import slugify from django.utils.text import slugify
from documents.models import AssociationDocumentsYear, MiscellaneousDocument
from documents.models import GeneralMeeting, GeneralMeetingDocument
from sendfile import sendfile from sendfile import sendfile
from documents.models import (AssociationDocumentsYear, GeneralMeeting,
GeneralMeetingDocument, MiscellaneousDocument)
from utils.snippets import datetime_to_lectureyear from utils.snippets import datetime_to_lectureyear
......
...@@ -3,6 +3,7 @@ This module registers admin pages for the models ...@@ -3,6 +3,7 @@ This module registers admin pages for the models
""" """
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from utils.translation import TranslatedModelAdmin from utils.translation import TranslatedModelAdmin
from . import models from . import models
......
from django.conf import settings from django.conf import settings
from django.forms import ( from django.forms import (ChoiceField, DateField, ModelChoiceField,
ModelForm, ModelForm, SelectDateWidget)
DateField,
SelectDateWidget,
ModelChoiceField,
ChoiceField
)
from .models import Exam, Summary, Course from .models import Course, Exam, Summary
class AddExamForm(ModelForm): class AddExamForm(ModelForm):
......
...@@ -4,11 +4,12 @@ import os ...@@ -4,11 +4,12 @@ import os
import requests import requests
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User 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.core.files.base import ContentFile
from django.utils.dateparse import parse_date from django.utils.dateparse import parse_date
from django.utils.translation import activate 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 from utils.management.commands import legacylogin
......
...@@ -3,8 +3,9 @@ from django.db import models ...@@ -3,8 +3,9 @@ from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from utils.snippets import datetime_to_lectureyear 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): class Category(models.Model, metaclass=ModelTranslateMeta):
......
import os
import itertools import itertools
import os
from datetime import datetime from datetime import datetime
from django.contrib.auth.decorators import login_required 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 django.utils.translation import ugettext_lazy as _
from sendfile import sendfile from sendfile import sendfile
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from activemembers.models import Committee
from django.contrib import admin from django.contrib import admin
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.urls import reverse from django.urls import reverse
...@@ -7,11 +6,12 @@ from django.utils import timezone ...@@ -7,11 +6,12 @@ from django.utils import timezone
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.http import is_safe_url from django.utils.http import is_safe_url
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from activemembers.models import Committee
from members.models import Member from members.models import Member
from utils.translation import TranslatedModelAdmin from utils.translation import TranslatedModelAdmin
from . import forms from . import forms, models
from . import models
def _do_next(request, response): def _do_next(request, response):
......
from django.utils import timezone
from django.urls import reverse from django.urls import reverse
from django.utils import timezone
from rest_framework import serializers from rest_framework import serializers
from events.models import Event from events.models import Event
......
from datetime import datetime
from django.utils import timezone
from rest_framework import viewsets from rest_framework import viewsets
from rest_framework.exceptions import ParseError from rest_framework.exceptions import ParseError
from rest_framework.response import Response from rest_framework.response import Response
from django.utils import timezone
from datetime import datetime
from events.api.serializers import EventSerializer from events.api.serializers import EventSerializer
from events.models import Event from events.models import Event
......
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import activate from django.utils.translation import activate
from django_ical.views import ICalFeed from django_ical.views import ICalFeed
from events.models import Event from events.models import Event
from django.utils.translation import ugettext as _
class EventFeed(ICalFeed): class EventFeed(ICalFeed):
......
from django import forms 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 from .models import RegistrationInformationField
......
import re
import json import json
import requests import re
from django.contrib.auth.models import User
from datetime import datetime from datetime import datetime
from django.core.management.base import BaseCommand
import requests
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
import events.models as events_models import events.models as events_models
import members.models as members_models import members.models as members_models
FIELD_DATA_TYPES = { FIELD_DATA_TYPES = {
'0': events_models.RegistrationInformationField.TEXT_FIELD, '0': events_models.RegistrationInformationField.TEXT_FIELD,
'1': events_models.RegistrationInformationField.INTEGER_FIELD, '1': events_models.RegistrationInformationField.INTEGER_FIELD,
......
...@@ -4,8 +4,10 @@ from django.db import models ...@@ -4,8 +4,10 @@ from django.db import models
from django.db.models import Q from django.db.models import Q
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _, string_concat from django.utils.translation import ugettext_lazy as _
from utils.translation import MultilingualField, ModelTranslateMeta from django.utils.translation import string_concat
from utils.translation import ModelTranslateMeta, MultilingualField
class Event(models.Model, metaclass=ModelTranslateMeta): class Event(models.Model, metaclass=ModelTranslateMeta):
......
...@@ -4,9 +4,8 @@ from django.core.exceptions import ValidationError ...@@ -4,9 +4,8 @@ from django.core.exceptions import ValidationError
from django.test import TestCase from django.test import TestCase
from django.utils import timezone from django.utils import timezone
from members.models import Member
from events.models import Event, Registration from events.models import Event, Registration
from members.models import Member
class RegistrationTest(TestCase): class RegistrationTest(TestCase):
......
...@@ -5,6 +5,7 @@ Events URL Configuration ...@@ -5,6 +5,7 @@ Events URL Configuration
from django.conf.urls import url from django.conf.urls import url
from events.feeds import EventFeed from events.feeds import EventFeed
from . import views from . import views
urlpatterns = [ urlpatterns = [
......
...@@ -2,18 +2,19 @@ import csv ...@@ -2,18 +2,19 @@ import csv
import json import json
from datetime import timedelta 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 import messages
from django.contrib.admin.views.decorators import staff_member_required 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 import timezone
from django.utils.text import slugify 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 .forms import FieldsForm
from .models import Event, Registration, RegistrationInformationField
@staff_member_required @staff_member_required
......
from django.contrib import admin from django.contrib import admin
from .models import MailingList, VerbatimAddress, ListAlias from .models import ListAlias, MailingList, VerbatimAddress
class VerbatimAddressInline(admin.TabularInline): class VerbatimAddressInline(admin.TabularInline):
......
import requests
from django.conf import settings from django.conf import settings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from activemembers.models import Committee, Board from activemembers.models import Board, Committee
from members.models import Member
from mailinglists.models import MailingList, VerbatimAddress from mailinglists.models import MailingList, VerbatimAddress
from members.models import Member
import requests
class Command(BaseCommand): class Command(BaseCommand):
......
from django.db import models
from django.core import validators from django.core import validators
from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from members.models import Member
from activemembers.models import Committee from activemembers.models import Committee
from members.models import Member
class MailingList(models.Model): class MailingList(models.Model):
......
import hashlib
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.shortcuts import render, get_object_or_404
from django.http import Http404 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 activemembers.models import CommitteeMembership
from members.models import Member
from .models import MailingList
import hashlib
# Consider replacing this completely; # Consider replacing this completely;
# - either by a cronjob Python script that queries the database directly # - either by a cronjob Python script that queries the database directly
......
...@@ -5,11 +5,11 @@ import datetime ...@@ -5,11 +5,11 @@ import datetime
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin 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.forms import UserCreationForm as BaseUserCreationForm
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from . import models, forms from . import forms, models
class MembershipInline(admin.StackedInline): class MembershipInline(admin.StackedInline):
......
import copy
from datetime import datetime
from django.utils import timezone from django.utils import timezone
from rest_framework import viewsets from rest_framework import viewsets
from rest_framework.decorators import list_route from rest_framework.decorators import list_route
from datetime import datetime
import copy
from rest_framework.exceptions import ParseError from rest_framework.exceptions import ParseError
from rest_framework.response import Response from rest_framework.response import Response
......
...@@ -4,7 +4,8 @@ from django import forms ...@@ -4,7 +4,8 @@ from django import forms
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.template import loader from django.template import loader
from django.utils import translation 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 .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.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured 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.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