Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Quick POC for #2823 #2920

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ django-grappelli==3.0.3
django-guardian==2.4.0
django-modern-rpc==0.12.1
django-simple-history==3.0.0
django-tabular-permissions==2.9.1
django-tree-queries==0.11.0
django-uuslug==2.0.0
jira==3.4.1
Expand Down
3 changes: 3 additions & 0 deletions tcms/bugs/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@


class AppConfig(DjangoAppConfig):
"a doc-string on the AppConfig class"

name = "tcms.bugs"
admin_docs = "a custom defined attribute"

def ready(self):
from tcms import signals
Expand Down
3 changes: 3 additions & 0 deletions tcms/bugs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


class Severity(models.Model):
"doc-string on model class"
name = models.CharField(max_length=64, unique=True)
weight = models.IntegerField(default=0)
icon = models.CharField(max_length=64)
Expand All @@ -21,7 +22,9 @@ def __str__(self):
return self.name

class Meta:
"docstring on meta class"
verbose_name_plural = _("Severity")
_custom_defined = ""


class Bug(models.Model, UrlMixin):
Expand Down
9 changes: 7 additions & 2 deletions tcms/kiwi_auth/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from django.utils.text import capfirst
from django.utils.translation import gettext_lazy as _

from tabular_permissions.admin import (
UserTabularPermissionsMixin,
GroupTabularPermissionsMixin,
)

from tcms.utils.user import delete_user

User = get_user_model() # pylint: disable=invalid-name
Expand Down Expand Up @@ -66,7 +71,7 @@ def save(self, commit=True):
return instance


class KiwiUserAdmin(UserAdmin):
class KiwiUserAdmin(UserTabularPermissionsMixin, UserAdmin):
list_display = UserAdmin.list_display + (
"is_active",
"is_superuser",
Expand Down Expand Up @@ -216,7 +221,7 @@ def delete_model(self, request, obj):
delete_user(obj)


class KiwiGroupAdmin(GroupAdmin):
class KiwiGroupAdmin(GroupTabularPermissionsMixin, GroupAdmin):
form = GroupAdminForm

def has_delete_permission(self, request, obj=None):
Expand Down
1 change: 1 addition & 0 deletions tcms/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
"captcha",
"colorfield",
"django_extensions",
"tabular_permissions",
"tree_queries",
"vinaigrette",
"tcms.core",
Expand Down