mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
PEP fixes
This commit is contained in:
parent
1ded9e1fc0
commit
c09b4980ad
@ -9,10 +9,10 @@ from django.contrib.auth import get_user_model
|
||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
from users.models import RuleSet
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class RuleSetInline(admin.TabularInline):
|
||||
model = RuleSet
|
||||
|
@ -14,7 +14,7 @@ class UsersConfig(AppConfig):
|
||||
try:
|
||||
self.assign_permissions()
|
||||
except (OperationalError, ProgrammingError):
|
||||
pass
|
||||
pass
|
||||
|
||||
def assign_permissions(self):
|
||||
|
||||
@ -30,4 +30,4 @@ class UsersConfig(AppConfig):
|
||||
# Update group permission assignments for all groups
|
||||
for group in Group.objects.all():
|
||||
|
||||
update_group_roles(group)
|
||||
update_group_roles(group)
|
||||
|
@ -71,7 +71,7 @@ class RuleSet(models.Model):
|
||||
'build_build',
|
||||
'build_builditem',
|
||||
'stock_stockitem',
|
||||
'stock_stocklocation',
|
||||
'stock_stocklocation',
|
||||
],
|
||||
'purchase_order': [
|
||||
'company_company',
|
||||
@ -139,6 +139,7 @@ class RuleSet(models.Model):
|
||||
|
||||
return self.RULESET_MODELS.get(self.name, [])
|
||||
|
||||
|
||||
def update_group_roles(group):
|
||||
"""
|
||||
Update group roles:
|
||||
@ -148,10 +149,10 @@ def update_group_roles(group):
|
||||
"""
|
||||
|
||||
# List of permissions which must be added to the group
|
||||
permissions_to_add = []
|
||||
# permissions_to_add = []
|
||||
|
||||
# List of permissions which must be removed from the group
|
||||
permissions_to_delete = []
|
||||
# permissions_to_delete = []
|
||||
|
||||
# Get all the rulesets associated with this group
|
||||
for r in RuleSet.RULESET_CHOICES:
|
||||
|
@ -87,4 +87,4 @@ class RuleSetModelTest(TestCase):
|
||||
if len(missing_models) > 0:
|
||||
print("WARNING: The following database models are not covered by the define RuleSet permissions:")
|
||||
for m in missing_models:
|
||||
print("-", m)
|
||||
print("-", m)
|
||||
|
Loading…
x
Reference in New Issue
Block a user