Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.9 KiB

16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
  1. # -*- coding: utf-8 -*-
  2. """
  3. * Copyright © 2009-2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  4. *
  5. * Mumble-Django is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This package is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. """
  15. from django.contrib import admin
  16. from django.utils.translation import ugettext_lazy as _
  17. from forms import MumbleAdminForm
  18. from models import Mumble, MumbleUser
  19. class MumbleAdmin(admin.ModelAdmin):
  20. list_display = [ 'name', 'addr', 'port', 'booted', 'getIsPublic', 'getUsersRegged', 'getUsersOnline', 'getChannelCnt' ];
  21. list_filter = [ 'booted', 'addr' ];
  22. search_fields = [ 'name', 'addr' ];
  23. ordering = [ 'name' ];
  24. form = MumbleAdminForm;
  25. def getUsersRegged( self, obj ):
  26. return obj.users_regged;
  27. getUsersRegged.short_description = _( 'Registered users' );
  28. def getUsersOnline( self, obj ):
  29. return obj.users_online;
  30. getUsersOnline.short_description = _( 'Online users' );
  31. def getChannelCnt( self, obj ):
  32. return obj.channel_cnt;
  33. getChannelCnt.short_description = _( 'Channel count' );
  34. def getIsPublic( self, obj ):
  35. if obj.is_public:
  36. return _( 'Yes' );
  37. return _( 'No' );
  38. getIsPublic.short_description = _( 'Public' );
  39. class MumbleUserAdmin(admin.ModelAdmin):
  40. list_display = [ 'owner', 'server', 'name', 'isAdmin' ];
  41. list_filter = [ 'server' ];
  42. search_fields = [ 'owner__username', 'name' ];
  43. ordering = [ 'owner__username' ];
  44. admin.site.register( Mumble, MumbleAdmin );
  45. admin.site.register( MumbleUser, MumbleUserAdmin );