Révision 38f397e5
Ajouté par Benjamin Dauvergne il y a plus de 10 ans
wcsinst/wcsinst/admin.py | ||
---|---|---|
24 | 24 |
{'fields': ('drupal', 'ezldap', 'strongbox', 'clicrdv', 'domino' )} |
25 | 25 |
), |
26 | 26 |
) |
27 |
readonly_fields = ('domain',) |
|
27 | 28 |
inlines = [VariablesInline, ApiSecretsInline] |
28 | 29 |
save_as = True |
29 | 30 |
|
31 |
def get_prepopulated_fields(self, request, obj=None): |
|
32 |
if obj: |
|
33 |
return {} |
|
34 |
return self.prepopulated_fields |
|
35 |
|
|
36 |
def get_readonly_fields(self, request, obj=None): |
|
37 |
readonly_fields = self.readonly_fields |
|
38 |
if not obj: |
|
39 |
return filter(lambda x: x != 'domain', readonly_fields) |
|
40 |
return readonly_fields |
|
41 |
|
|
30 | 42 |
|
31 | 43 |
admin.site.register(WcsInstance, WcsInstanceAdmin) |
Formats disponibles : Unified diff
admin: make the domain field read-only after creation
fixes #3937