I tried to apply a markdown plugin martor to my blog project which gives a nice toolbar in Django Admin. Then I followed its instruction to apply the changes to my models.py and expected to see the same toolbar in my frontend blog post editor. However it doesn't work (it looks like this:
.
I also tried the suggestions in the post, still doesn't work.
Here is my code (model.py):
## models.py
from django.db import models
from django.utils import timezone
from martor.models import MartorField
class Post(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
title = models.CharField(max_length=200)
#text = models.TextField()
text = MartorField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)
And forms.py
## forms.py
from django.forms import ModelForm
from martor.fields import MartorFormField
from martor.widgets import AdminMartorWidget
from .models import Post, Comment
class PostForm(ModelForm):
class Meta:
model = Post
fields = ('title', 'text',)
How can I add the markdown toolbar as in Django Admin (the figure1) into my blog editing page? Thanks in advance!