Skip to content

Commit

Permalink
[ADD] Disabled changing of user and name to maintain location of files
Browse files Browse the repository at this point in the history
  • Loading branch information
kumanik committed Jun 3, 2021
1 parent ce23efa commit 6759e55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions esim-cloud-backend/libAPI/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ class LibrarySetForm(forms.ModelForm):
widget=forms.ClearableFileInput(attrs={'multiple': True})
)

def __init__(self, *args, **kwargs):
super(LibrarySetForm, self).__init__(*args, **kwargs)
instance = getattr(self, 'instance', None)
if instance and instance.pk:
self.fields['user'].widget.attrs['disabled'] = True
self.fields['name'].widget.attrs['readonly'] = True

class Meta:
model = LibrarySet
fields = ('name', 'user', 'default', 'files')

0 comments on commit 6759e55

Please sign in to comment.