Commit 1a0c4303 by Kálmán Viktor

dashboard: add created and modified to disk form

https://docs.djangoproject.com/en/1.7/ref/models/fields/#editable
parent 7ff1ff3f
...@@ -1607,11 +1607,16 @@ class DataStoreForm(ModelForm): ...@@ -1607,11 +1607,16 @@ class DataStoreForm(ModelForm):
class DiskForm(ModelForm): class DiskForm(ModelForm):
created = forms.DateTimeField()
modified = forms.DateTimeField()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(DiskForm, self).__init__(*args, **kwargs) super(DiskForm, self).__init__(*args, **kwargs)
for k, v in self.fields.iteritems(): for k, v in self.fields.iteritems():
v.widget.attrs['readonly'] = True v.widget.attrs['readonly'] = True
self.fields['created'].initial = self.instance.created
self.fields['modified'].initial = self.instance.modified
class Meta: class Meta:
model = Disk model = Disk
...@@ -72,3 +72,6 @@ class DiskDetail(SuperuserRequiredMixin, UpdateView): ...@@ -72,3 +72,6 @@ class DiskDetail(SuperuserRequiredMixin, UpdateView):
model = Disk model = Disk
form_class = DiskForm form_class = DiskForm
template_name = "dashboard/storage/disk.html" template_name = "dashboard/storage/disk.html"
def form_valid(self, form):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment