-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Preview not working #32
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I think you should choose one of the existing methods, not using it together. |
@agusmakmun What do you mean existing methods? |
If I remove the self.fields['description'] call, the behavior persists. |
from django.db import models
from martor.models import MartorField
class Question(models.Model, HitCountMixin):
title = models.CharField(max_length=200, blank=False)
description = MartorField()
from django.db import models
from django.contrib import admin
from martor.widgets import AdminMartorWidget
from yourapp.models import Question
class QuestionAdmin(admin.ModelAdmin):
formfield_overrides = {
models.TextField: {'widget': AdminMartorWidget},
}
admin.site.register(Question, QuestionAdmin)
class QuestionForm(forms.ModelForm):
class Meta:
model = Question
fields = ['title', 'description']
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super(QuestionForm, self).__init__(*args, **kwargs)
self.fields['description'] = MartorFormField() |
I've edited my QuestionForm to resemble option 3, and preview still does not work. It displays the exact same text as before. |
Have you loaded the CSS & JS files? <link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" />
<link href="{% static 'plugins/css/semantic.min.css' %}" type="text/css" media="all" rel="stylesheet" />
<link href="{% static 'plugins/css/resizable.min.css' %}" type="text/css" media="all" rel="stylesheet" />
<link href="{% static 'martor/css/martor.min.css' %}" type="text/css" media="all" rel="stylesheet" /> and <script type="text/javascript" src="{% static 'plugins/js/ace.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/semantic.min.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/mode-markdown.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/ext-language_tools.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/theme-github.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/resizable.min.js' %}"></script>
<script type="text/javascript" src="{% static 'plugins/js/emojis.min.js' %}"></script>
<script type="text/javascript" src="{% static 'martor/js/martor.min.js' %}"></script> |
Forgot to do that! Thank you. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Instead of getting a preview, it just looks exactly like the raw text in the editor box.
models.py:
forms.py
EDIT
My new form looks like this:
The text was updated successfully, but these errors were encountered: