Ajax/POSTを使用してモデルを更新しようとしています。フォームのすべてのフィールドではなく、更新されているフィールドだけを送信できるようにしたいと思います。しかし、これはフォームが無効になっているようです。これを行う良い方法はありますか?モデルを更新するAjaxとModelForm
例:名前を更新するときに
class Video(models.Model):
name = models.CharField(max_length=100)
type = models.CharField(max_length=100)
owner = models.ForeignKey(User, related_name='videos')
...
#Related m2m fields
....
class VideoForm(modelForm):
class Meta:
model = Video
fields = ('name', 'type', 'owner')
class VideoCreate(CreateView):
template_name = 'video_form.html'
form_class = VideoForm
model = Video
私は
更新タイプの{'name': 'new name', 'type':'existing type', 'owner': 'current owner'}
、同様とは対照的に、このデータ
{'name': 'new name'}
でPOSTを送信したいのですが。
これを行うには良い方法がありますか?