Commits

Peter Nixon committed 91b6400

Update models and admin to match newer Django versions

Comments (0)

Files changed (2)

freeradius/admin.py

+# -*- coding: utf-8 -*-
+from django.contrib import admin
+
+from freeradius.models import Attributelist
+from freeradius.models import Nas
+from freeradius.models import Radpostauth
+from freeradius.models import Realmgroup
+from freeradius.models import Realms
+from freeradius.models import Radreply
+from freeradius.models import Radusergroup
+from freeradius.models import Radcheck
+from freeradius.models import Radgroupcheck
+from freeradius.models import Radgroupreply
+from freeradius.models import Radippool
+from freeradius.models import Radacct
+
+
+class AttributelistAdmin(admin.ModelAdmin):
+    list_display   = ('attribute', 'enabled', 'checkitem',)
+    list_filter    = ('enabled', 'checkitem',)
+    ordering       = ('attribute', )
+    search_fields  = ('attribute',)
+
+class NasAdmin(admin.ModelAdmin):
+    list_display   = ('nasname', 'shortname', 'type', 'ports', 'naslocation',)
+    list_filter    = ('type', 'naslocation',)
+    ordering       = ('nasname', )
+    search_fields  = ('nasname', 'shortname', 'ports', 'naslocation',)
+
+class RadpostauthAdmin(admin.ModelAdmin):
+    pass
+
+class RealmgroupAdmin(admin.ModelAdmin):
+    pass
+
+class RealmsAdmin(admin.ModelAdmin):
+    pass
+
+class RadreplyAdmin(admin.ModelAdmin):
+    list_display   = ('calledstationid', 'custid', 'username', 'attribute', 'op', 'value',)
+    list_filter    = ('calledstationid', 'custid', 'username',)
+    search_fields  = ('attribute', 'value',)
+
+class RadusergroupAdmin(admin.ModelAdmin):
+    list_display   = ('groupname', 'username',)
+    list_filter    = ('groupname',)
+    search_fields  = ('username',)
+
+class RadcheckAdmin(admin.ModelAdmin):
+    list_display   = ('username', 'attribute', 'op', 'value',)
+    list_filter    = ('username',)
+    search_fields  = ('attribute', 'value',)
+
+class RadgroupcheckAdmin(admin.ModelAdmin):
+    list_display   = ('groupname', 'attribute', 'op', 'value',)
+    list_filter    = ('groupname',)
+
+class RadgroupreplyAdmin(admin.ModelAdmin):
+    list_display   = ('groupname', 'attribute', 'op', 'value',)
+    list_filter    = ('groupname',)
+
+class RadippoolAdmin(admin.ModelAdmin):
+    pass
+
+class RadacctAdmin(admin.ModelAdmin):
+    list_display   = ('acctuniqueid', 'username', 'nasipaddress', 'acctstarttime', 'acctsessiontime',)
+    list_filter    = ('nasipaddress',)
+
+
+admin.site.register(Attributelist,AttributelistAdmin)
+admin.site.register(Nas,NasAdmin)
+admin.site.register(Radpostauth,RadpostauthAdmin)
+admin.site.register(Realmgroup,RealmgroupAdmin)
+admin.site.register(Realms,RealmsAdmin)
+admin.site.register(Radreply,RadreplyAdmin)
+admin.site.register(Radusergroup,RadusergroupAdmin)
+admin.site.register(Radcheck,RadcheckAdmin)
+admin.site.register(Radgroupcheck,RadgroupcheckAdmin)
+admin.site.register(Radgroupreply,RadgroupreplyAdmin)
+admin.site.register(Radippool,RadippoolAdmin)
+admin.site.register(Radacct,RadacctAdmin)
+
+
+

freeradius/models.py

     groupname = models.CharField(max_length=30)
     def __str__(self):
         return str(self.realmname)
-    class Admin:
-        pass
     class Meta:
         db_table = 'realmgroup'
 
     options = models.CharField(max_length=128)
     def __str__(self):
         return str(self.realmname)
-    class Admin:
-        pass
     class Meta:
         db_table = 'realms'
         verbose_name_plural = "realms"
     checkitem = models.BooleanField()
     def __str__(self):
         return str(self.attribute)
-    class Admin:
-        list_display   = ('attribute', 'enabled', 'checkitem',)
-        list_filter    = ('enabled', 'checkitem',)
-        ordering       = ('attribute', )
-        search_fields  = ('attribute',)
     class Meta:
         db_table = 'attributelist'
 
     snmp = models.CharField(max_length=10, blank=True, null=True)
     def __str__(self):
         return str(self.nasname)
-    class Admin:
-        list_display   = ('nasname', 'shortname', 'type', 'ports', 'naslocation',)
-        list_filter    = ('type', 'naslocation',)
-        ordering       = ('nasname', )
-        search_fields  = ('nasname', 'shortname', 'ports', 'naslocation',)
     class Meta:
         db_table = 'nas'
         verbose_name_plural = "nas"
     callingstationid = models.CharField(max_length=50)
     def __str__(self):
         return str(self.username)
-    class Admin:
-        pass
     class Meta:
         db_table = 'radpostauth'
         verbose_name_plural = "radpostauth"
     custid = models.IntegerField()
     def __str__(self):
         return str(self.username)
-    class Admin:
-        list_display   = ('calledstationid', 'custid', 'username', 'attribute', 'op', 'value',)
-        list_filter    = ('calledstationid', 'custid', 'username',)
-        search_fields  = ('attribute', 'value',)
     class Meta:
         db_table = 'radreply'
         verbose_name_plural = "radreply"
     calledstationid = models.CharField(max_length=64)
     def __str__(self):
         return str(self.username)
-    class Admin:
-        list_display   = ('groupname', 'username',)
-        list_filter    = ('groupname',)
-        search_fields  = ('username',)
     class Meta:
         db_table = 'radusergroup'
 
     value = models.CharField(max_length=253)
     def __str__(self):
         return str(self.username)
-    class Admin:
-        list_display   = ('username', 'attribute', 'op', 'value',)
-        list_filter    = ('username',)
-        search_fields  = ('attribute', 'value',)
     class Meta:
         db_table = 'radcheck'
         verbose_name_plural = "radcheck"
     attribute = models.CharField(max_length=64)
     op = models.CharField(max_length=2, choices=RADOP_CHECK_TYPES)
     value = models.CharField(max_length=253)
-    class Admin:
-        list_display   = ('groupname', 'attribute', 'op', 'value',)
-        list_filter    = ('groupname',)
     class Meta:
         db_table = 'radgroupcheck'
         verbose_name_plural = "radgroupcheck"
     value = models.CharField(max_length=253)
     def __str__(self):
         return str(self.groupname)
-    class Admin:
-        list_display   = ('groupname', 'attribute', 'op', 'value',)
-        list_filter    = ('groupname',)
     class Meta:
         db_table = 'radgroupreply'
         verbose_name_plural = "radgroupreply"
     def __str__(self):
         return str(self.framedipaddress)
     class Meta:
-        pass
-    class Meta:
         db_table = 'radippool'
-	verbose_name_plural = "radippool"
+        verbose_name_plural = "radippool"
 
 class Radacct(models.Model):
     radacctid = models.AutoField(primary_key=True)
     xascendsessionsvrkey = models.CharField(max_length=10, null=True)
     def __str__(self):
         return str(self.acctuniqueid)
-    class Admin:
-        list_display   = ('acctuniqueid', 'username', 'nasipaddress', 'acctstarttime', 'acctsessiontime',)
-        list_filter    = ('nasipaddress',)
     class Meta:
         db_table = 'radacct'
         verbose_name_plural = "radacct"