Skip to content

Commit

Permalink
Merge pull request #21 from ataylor32/admin
Browse files Browse the repository at this point in the history
Replace the "SessionAdmin" class' readonly_fields with has_add_permission and has_change_permission
  • Loading branch information
mjnaderi authored Jun 22, 2024
2 parents 7984306 + 769704c commit ea77106
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions qsessions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,6 @@ def queryset(self, request, queryset):
class SessionAdmin(admin.ModelAdmin):
list_display = ("ip", linkify("user"), "is_valid", "created_at", "expire_date", "device", "location")
list_select_related = ("user",)
readonly_fields = (
"ip",
"location",
"user",
"is_valid",
"expire_date",
"created_at",
"updated_at",
"user_agent",
"device",
"session_key",
"session_data_decoded",
)
list_filter = ExpiredFilter, OwnerFilter
fields = (
"user",
Expand Down Expand Up @@ -107,3 +94,9 @@ def session_data_decoded(self, obj):
'<pre style="white-space: pre-wrap; max-width: 800px; display: inline-block; direction: ltr;">{}</pre>',
pformat(obj.get_decoded()),
)

def has_add_permission(self, request):
return False

def has_change_permission(self, request, obj=None):
return False

1 comment on commit ea77106

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
qsessions
   admin.py58395%21, 42–43
   geoip.py27678%15, 21–23, 51–53
tests
   test_sessionstore.py99199%144
TOTAL4441098% 

Tests Skipped Failures Errors Time
48 0 💤 0 ❌ 0 🔥 2.723s ⏱️

Please sign in to comment.