1๐
โ
If you only want some of the fields to be editable, you should set fields
in your model form. If you use PostForm
in another view and cannot edit fields
, then create a new form.
class EditPostForm(forms.ModelForm):
class Meta:
model = Post
fields = ['content']
You can subclass PostForm
if you prefer:
class EditPostForm(PostForm):
class Meta(PostForm.Meta):
fields = ['content']
Then update your edit view to use EditPostForm
instead of PostForm
.
๐คAlasdair
Source:stackexchange.com