django-admin-json-editor icon indicating copy to clipboard operation
django-admin-json-editor copied to clipboard

cache issue in django admin json editor

Open mavajikitl opened this issue 3 years ago • 0 comments

Hi,

I am using this extension(0.2.3) with Django 3.1.3 Added 1 entry via this form, when adding second entry with new data, sometimes it adds entry with first entry's data, it looks like it caching form data somewhere.

Please check the code below and help.

Thanks.

POLICY_FORM = {
  "title": "Policy",
  "type": "object",
  "required": [
    "Clicks",
    "Rate"
  ],
  "properties": {
    "Clicks": {
      "type": "number",
      "default": 0,
      "minimum": 0,
      # "maximum": 9900
    },
    "Rate": {
      "type": "number",
      "default": 0,
      "minimum": 0,
      # "maximum": 9900
    }
  }
 }

JSON_OPTION = {
    "theme": "html", 
    "disable_collapse": True,
    "disable_edit_json": True,
    "disable_properties": True,
  }
class PolicyForm(forms.ModelForm):
     policy = forms.JSONField(widget = JSONEditorWidget(POLICY_FORM, collapsed=False, editor_options=JSON_OPTION))

mavajikitl avatar Sep 13 '21 11:09 mavajikitl