Skip to content

Commit fb39126

Browse files
authored
Merge pull request #22 from 2ik/main
main to dev
2 parents d9efa10 + 5ebdeef commit fb39126

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Add code in your model
4040
```python
4141
# models.py
4242
from django.db import models
43-
from django_editorjs_fields import EditorJsJSONFiel # Django >= 3.1
43+
from django_editorjs_fields import EditorJsJSONField # Django >= 3.1
4444
from django_editorjs_fields import EditorJsTextField
4545

4646

django_editorjs_fields/templatetags/editorjs.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,30 +144,31 @@ def editorjs(value):
144144
for item in value['blocks']:
145145

146146
type, data = item.get('type'), item.get('data')
147+
type = type.lower()
147148

148149
if type == 'paragraph':
149150
html_list.append(generate_paragraph(data))
150-
elif type == 'Header':
151+
elif type == 'header':
151152
html_list.append(generate_header(data))
152-
elif type == 'List':
153+
elif type == 'list':
153154
html_list.append(generate_list(data))
154-
elif type == 'Image':
155+
elif type == 'image':
155156
html_list.append(generate_image(data))
156-
elif type == 'Delimiter':
157+
elif type == 'delimiter':
157158
html_list.append(generate_delimiter())
158-
elif type == 'Warning':
159+
elif type == 'warning':
159160
html_list.append(generate_warning(data))
160-
elif type == 'Table':
161+
elif type == 'table':
161162
html_list.append(generate_table(data))
162-
elif type == 'Code':
163+
elif type == 'code':
163164
html_list.append(generate_code(data))
164-
elif type == 'Raw':
165+
elif type == 'raw':
165166
html_list.append(generate_raw(data))
166-
elif type == 'Embed':
167+
elif type == 'embed':
167168
html_list.append(generate_embed(data))
168-
elif type == 'Quote':
169+
elif type == 'quote':
169170
html_list.append(generate_quote(data))
170-
elif type == 'LinkTool':
171+
elif type == 'linktool':
171172
html_list.append(generate_link(data))
172173

173174
return mark_safe(''.join(html_list))

0 commit comments

Comments
 (0)