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

Remove session_key from admin by default #64

Merged
merged 4 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='django-user-sessions',
version='1.3.1',
version='1.3.2',
description='Django sessions with a foreign key to the user',
long_description=open('README.rst').read(),
author='Bouke Haarsma',
Expand Down
4 changes: 4 additions & 0 deletions user_sessions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.contrib import admin
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.conf import settings

try:
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -53,6 +54,9 @@ class SessionAdmin(admin.ModelAdmin):
list_filter = ExpiredFilter, OwnerFilter
raw_id_fields = 'user',

if getattr(settings, 'USER_SESSIONS_ADMIN_EXCLUDE_SESSION_KEY',True):
exclude = 'session_key',

def __init__(self, *args, **kwargs):
super(SessionAdmin, self).__init__(*args, **kwargs)
if not self.search_fields and django.VERSION[:2] < (1, 7):
Expand Down