Browse Source

Make the LDAP primary key for VPN read-only

Baptiste Jonglez 11 years ago
parent
commit
5e7bf1013a
1 changed files with 8 additions and 1 deletions
  1. 8 1
      coin/vpn/admin.py

+ 8 - 1
coin/vpn/admin.py

@@ -2,4 +2,11 @@ from django.contrib import admin
 
 from coin.vpn.models import VPNSubscription
 
-admin.site.register(VPNSubscription,)
+class VPNAdmin(admin.ModelAdmin):
+    def get_readonly_fields(self, request, obj=None):
+        if obj:
+            return ['login',]
+        else:
+            return []
+
+admin.site.register(VPNSubscription, VPNAdmin)