mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Tweaks for settings admin views
This commit is contained in:
		| @@ -12,11 +12,31 @@ class SettingsAdmin(ImportExportModelAdmin): | ||||
|  | ||||
|     list_display = ('key', 'value') | ||||
|  | ||||
|     def get_readonly_fields(self, request, obj=None): | ||||
|         """ | ||||
|         Prevent the 'key' field being edited once the setting is created | ||||
|         """ | ||||
|  | ||||
|         if obj: | ||||
|             return ['key',] | ||||
|         else: | ||||
|             return [] | ||||
|  | ||||
|  | ||||
| class UserSettingsAdmin(ImportExportModelAdmin): | ||||
|  | ||||
|     list_display = ('key', 'value', 'user', ) | ||||
|  | ||||
|     def get_readonly_fields(self, request, obj=None): | ||||
|         """ | ||||
|         Prevent the 'key' field being edited once the setting is created | ||||
|         """ | ||||
|  | ||||
|         if obj: | ||||
|             return ['key',] | ||||
|         else: | ||||
|             return [] | ||||
|  | ||||
|  | ||||
| class NotificationEntryAdmin(admin.ModelAdmin): | ||||
|  | ||||
|   | ||||
| @@ -63,6 +63,8 @@ class BaseInvenTreeSetting(models.Model): | ||||
|         Enforce validation and clean before saving | ||||
|         """ | ||||
|  | ||||
|         self.key = str(self.key).upper() | ||||
|  | ||||
|         self.clean() | ||||
|         self.validate_unique() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user