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.

55 lines
1.8 KiB

16 years ago
16 years ago
16 years ago
16 years ago
  1. # -*- coding: utf-8 -*-
  2. """
  3. * Copyright (C) 2009, 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 models import *
  18. class MumbleAdmin(admin.ModelAdmin):
  19. list_display = [ 'name', 'addr', 'port', 'booted', 'getIsPublic', 'getUsersRegged', 'getUsersOnline', 'getChannelCnt' ];
  20. list_filter = [ 'booted', 'addr' ];
  21. search_fields = [ 'name', 'addr' ];
  22. ordering = [ 'name' ];
  23. def getUsersRegged( self, obj ):
  24. return obj.users_regged;
  25. getUsersRegged.short_description = _( 'Registered users' );
  26. def getUsersOnline( self, obj ):
  27. return obj.users_online;
  28. getUsersOnline.short_description = _( 'Online users' );
  29. def getChannelCnt( self, obj ):
  30. return obj.channel_cnt;
  31. getChannelCnt.short_description = _( 'Channel count' );
  32. def getIsPublic( self, obj ):
  33. if obj.is_public:
  34. return _( 'Yes' );
  35. return _( 'No' );
  36. getIsPublic.short_description = _( 'Public' );
  37. class MumbleUserAdmin(admin.ModelAdmin):
  38. list_display = [ 'owner', 'server', 'name' ];
  39. list_filter = [ 'server' ];
  40. search_fields = [ 'owner__username', 'name' ];
  41. ordering = [ 'owner__username' ];
  42. admin.site.register( Mumble, MumbleAdmin );
  43. admin.site.register( MumbleUser, MumbleUserAdmin );