Skip to content

Commit

Permalink
fixes for isort and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
manelclos committed Mar 22, 2021
1 parent 4239f8d commit dc95b36
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 12 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org

root = true

[*]
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8

[*.py]
indent_style = space
indent_size = 4
max_line_length = 119
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.coverage
/build/
/dist/
/django_groupadmin_users.egg-info/
/django_groupadmin_users.egg-info/
/.tox/
2 changes: 1 addition & 1 deletion groupadmin_users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from groupadmin_users.forms import GroupAdminForm


# Unregister the original Group admin.
admin.site.unregister(Group)

Expand All @@ -15,5 +14,6 @@ class GroupAdmin(admin.ModelAdmin):
# Filter permissions horizontal as well.
filter_horizontal = ['permissions']


# Register the new Group ModelAdmin.
admin.site.register(Group, GroupAdmin)
15 changes: 7 additions & 8 deletions groupadmin_users/forms.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Code from https://stackoverflow.com/a/39648244/593907
# modified according to https://docs.djangoproject.com/en/1.11/topics/forms/modelforms/#the-save-method # noqa
from django import forms, VERSION
from django.contrib import admin
from django.contrib.auth import get_user_model
from django import VERSION, forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _

Expand All @@ -18,11 +17,11 @@ class Meta:

# Add the users field.
users = forms.ModelMultipleChoiceField(
queryset=User.objects.all(),
required=False,
# Use the pretty 'filter_horizontal widget'.
widget=FilteredSelectMultiple('users', False),
label=_('Users'),
queryset=User.objects.all(),
required=False,
# Use the pretty 'filter_horizontal widget'.
widget=FilteredSelectMultiple('users', False),
label=_('Users'),
)

def __init__(self, *args, **kwargs):
Expand Down
26 changes: 26 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[flake8]
ignore = D203,C0111,W503
exclude = .git,*migrations/*.py
max-line-length = 119
select = C,E,F,W,B

[isort]
line_length=119
wrap_length=119
skip_glob=*migrations/*.py
default_section = THIRDPARTY
include_trailing_comma = True
known_first_party = groupadmin_users, tests
known_django = django
known_django_extra =
sections = FUTURE,STDLIB,THIRDPARTY,DJANGO,DJANGO_EXTRA,FIRSTPARTY,LOCALFOLDER

[coverage:report]
precision = 2

[coverage:run]
omit =
django_project/asgi.py
django_project/wsgi.py
manage.py
setup.py
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from distutils.core import setup
from setuptools import find_packages

from setuptools import find_packages

VERSION = '0.3.3'

Expand Down
2 changes: 1 addition & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import VERSION
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User, Group
from django.contrib.auth.models import Group, User
from django.test import TestCase

from groupadmin_users.admin import GroupAdmin
Expand Down

0 comments on commit dc95b36

Please sign in to comment.