Django 使用UpdateView的自定义表单字段呈现不保存数据

Django 使用UpdateView的自定义表单字段呈现不保存数据,django,python-3.x,django-forms,django-templates,django-views,Django,Python 3.x,Django Forms,Django Templates,Django Views,我正在尝试使用自定义HTML来呈现表单字段元素。但是,现在数据没有保存。如果使用默认的表单.as\p方法,则数据正在保存 相关模板: <!--DOES NOT SAVE DATA--> <form action="" method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.description }} <input type="submit" value="U

我正在尝试使用自定义HTML来呈现表单字段元素。但是,现在数据没有保存。如果使用默认的
表单.as\p
方法,则数据正在保存

相关模板:

<!--DOES NOT SAVE DATA-->
<form action="" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    {{ form.description }}
    <input type="submit" value="Update"/>
</form>
相关模型:

class ProfileCreateForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = 'platform', 'content_niche', 'youtube_channel_id', 'description','profile_img', 'v_id_0', 'v_id_0_title', 'v_id_0_desc', \
                 'v_id_1', 'v_id_1_title', 'v_id_1_desc', 'v_id_2', 'v_id_2_title', 'v_id_2_desc'

是否因为自定义呈现方法未验证表单数据?如果是这样,我将如何使用updateview来实现这一点

它可能不起作用,因为您只显示description字段,并且至少需要一个其他字段;另外,您没有显示任何表单错误。这是正确的答案。我没有包括所有的表单字段。它可能不起作用,因为您只显示了description字段,并且至少需要一个其他字段;另外,您没有显示任何表单错误。这是正确的答案。我没有包括所有的表单字段。
class ProfileEditView(UserPassesTestMixin, UpdateView):
    model = Profile
    form_class = ProfileCreateForm
    template_name = 'update_profile_backup.html'

    def get_success_url(self):
        return reverse('profile', kwargs={'pk': self.object.pk})

    def test_func(self):
        obj = self.get_object()
        print(obj.user == self.request.user)
        return obj.user == self.request.user
class ProfileCreateForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = 'platform', 'content_niche', 'youtube_channel_id', 'description','profile_img', 'v_id_0', 'v_id_0_title', 'v_id_0_desc', \
                 'v_id_1', 'v_id_1_title', 'v_id_1_desc', 'v_id_2', 'v_id_2_title', 'v_id_2_desc'