diff --git a/src/rockstor/storageadmin/models/nfs_export_group.py b/src/rockstor/storageadmin/models/nfs_export_group.py index 06afb5146..1c98f8e75 100644 --- a/src/rockstor/storageadmin/models/nfs_export_group.py +++ b/src/rockstor/storageadmin/models/nfs_export_group.py @@ -28,9 +28,10 @@ class NFSExportGroup(models.Model): INSECURE = "insecure" """hostname string in /etc/exports""" - host_str = models.CharField(max_length=4096, validators=[validators.validate_nfs_host_str]) + host_str = models.CharField( + max_length=4096, validators=[validators.validate_nfs_host_str] + ) """mount options""" - """mount read only by default""" MODIFY_CHOICES = ( (READ_ONLY, "ro"), (READ_WRITE, "rw"), @@ -69,3 +70,4 @@ class NFSExportGroup(models.Model): class Meta: app_label = "storageadmin" + ordering = ["-id"] diff --git a/src/rockstor/storageadmin/views/nfs_exports.py b/src/rockstor/storageadmin/views/nfs_exports.py index 38171bbc8..2d94a1aa1 100644 --- a/src/rockstor/storageadmin/views/nfs_exports.py +++ b/src/rockstor/storageadmin/views/nfs_exports.py @@ -170,6 +170,7 @@ def post(self, request): cur_exports = list(NFSExport.objects.all()) eg = NFSExportGroup(**options) + eg.clean_fields(exclude="admin_host") eg.save() for s in shares: mnt_pt = "%s%s" % (settings.MNT_PT, s.name) @@ -237,6 +238,7 @@ def put(self, request, export_id): s, options["host_str"], request, export_id=int(export_id) ) NFSExportGroup.objects.filter(id=export_id).update(**options) + NFSExportGroup.objects.filter(id=export_id)[0].clean_fields(exclude="admin_host") NFSExportGroup.objects.filter(id=export_id)[0].save() cur_exports = list(NFSExport.objects.all()) for e in NFSExport.objects.filter(export_group=eg):