Closed tbicr closed 11 years ago
You can customise templates to include extra JS/CSS without changing model converter.
For example:
{% extends 'admin/model/edit.html' %}
{% block head %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/master.css') }}" />
{% endblock %}
{% block tail %}
<script src="{{ url_for('static', filename='js/myeditor.js') }}"></script>
<script language="javascript">
alert('foo');
</script>
{% endblock %}
and then use it instead of standard template:
class MyModelAdmin(ModelView):
create_template = 'myedit.html'
edit_template = 'myedit.html'
then just inherit your models from this base class.
I made gist which illustrates how you can integrate CKEditor. For now, I think it is better to keep it separate and don't integrate with the Flask-Admin core.
Gist in question: https://gist.github.com/mrjoes/5189850
Probably better add to examples?
Good idea, will do.
I don't find WYSIWYG/markup support. I found https://github.com/jhollingworth/bootstrap-wysihtml5/ WYSIWYG editor for twitter bootstrap and implement this issue for me:
Python
I add custom
model_form_converter
which applying by field nameTemplates
I add
wysiwyg-create.html
andwysiwyg-edit.html
templates extended bycreate.html
andedit.html
:JS
CSS
Maybe it's not good code, but to have base or/and easy extending solution for WYSWYG support look good idea. For me it's site content editing.
UPD. Sorry, not found #15 at first. UPD 2. Updated examples with custom templates by @mrjoes comment.