django-jsonforms如何删除JSON:jsonschemaform字段的标签?

mfpqipee  于 2023-06-25  发布在  Go
关注(0)|答案(1)|浏览(99)

我正在使用Django-Jsonforms。我正在尝试删除图片中的“Json:“。

b =  {
     "title": "Product",
   "description": "A product",
   "type": "object",
   "properties": {
      "Products": {
          "type": "array",
          "products": {
              "type": "string"
          },
          "minItems": 0,
          "maxItems": 5,
      }
  }
}

我已经尝试了self.fields["form"].label = "myform"和更改小部件,并将“label”,“ui:label”等。在schema中。我在文件里找不到任何东西?

bwleehnv

bwleehnv1#

在forms.py

from django_jsonforms.forms import JSONSchemaField
from django import forms

class MyForm(forms.Form):
    options = {"no_additional_properties": True,
               "disable_collapse": True,
               "disable_edit_json": True,
               "disable_properties": True,
               }

    form = JSONSchemaField(schema='schema/schema.json', options=options, ajax=False)
    form.label = ''

html格式

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <form method="POST">
    {% csrf_token %}

    {{ form }}
    {{ form.media }}
    <button type="submit">submit</button>
  </form>

相关问题