I use the wysiwyg editor editor to record my content. There is only a wysiwyg editor on the page and a save button.
HTML:
<div id="editor-wrapper"> <input type="text" id="editor-title" {%if blog %} value="{{blog.title}}" {% else %} placeholder="Your title" {% endif %}> <textarea id="editor-redactor" name="content"> {% if blog %} {{ blog.body }} {% else %} <p>Enter you body in here...</p> {% endif %} </textarea> <button id="save-btn"><a href="/save-blog/">Save</a> </button> </div>
And in urls.py I added a url to go to this page.
url(r'^add-update-blog/$', views.add_update_blog), url(r'^add-update-blog/save/(?P<blog_id>\d+)$', views.add_update_blog),
views.py:
def add_update_blog(request): return render(request, 'editor.html') def add_update_blog_save(request, blog_id): blog = Blog.objects.get(id=blog_id) return render(request, 'editor.html', { blog: blog })
Now, in the django-admin panel, there may be a list of already written content:
- If I click add, I want to go to the editor page.
- If I click on any of the already written content object, I want to get this object and load it on the editor page.
At the moment, it displays a list and when I click the add button or the content that appears only in the admin panel. How can I achieve what I want? Your help and guidance is really very studied. Thanks.
source share