forked from sshwsfc/xadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate admin log entry from django admin.
- Loading branch information
Showing
21 changed files
with
3,701 additions
and
1,743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
import xadmin | ||
from models import UserSettings | ||
from models import UserSettings, Log | ||
from xadmin.layout import * | ||
|
||
from django.utils.translation import ugettext_lazy as _, ugettext | ||
|
||
class UserSettingsAdmin(object): | ||
model_icon = 'fa fa-cog' | ||
hidden_menu = True | ||
|
||
xadmin.site.register(UserSettings, UserSettingsAdmin) | ||
|
||
class LogAdmin(object): | ||
|
||
def link(self, instance): | ||
if instance.content_type and instance.object_id and instance.action_flag != 'delete': | ||
admin_url = self.get_admin_url('%s_%s_change' % (instance.content_type.app_label, instance.content_type.model), | ||
instance.object_id) | ||
return "<a href='%s'>%s</a>" % (admin_url, _('Admin Object')) | ||
else: | ||
return '' | ||
link.short_description = "" | ||
link.allow_tags = True | ||
link.is_column = False | ||
|
||
list_display = ('action_time', 'user', 'ip_addr', '__str__', 'link') | ||
list_filter = ['user', 'action_time'] | ||
search_fields = ['ip_addr', 'message'] | ||
model_icon = 'fa fa-cog' | ||
|
||
xadmin.site.register(Log, LogAdmin) |
Oops, something went wrong.