klen / django_markdown Goto Github PK
View Code? Open in Web Editor NEWDjango markdown support and wysiwig
License: GNU Lesser General Public License v3.0
Django markdown support and wysiwig
License: GNU Lesser General Public License v3.0
I am using this in my forms, but the editor width is too much that is going outside the region, i have applied all width control attributes to div , but the widget is always going outside the region. Is there any way to set max-width of markdown editor in forms.?
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/8245074-set-height-width-for-markdown-forms-widget?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).Error during template rendering
In template C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\admin\templates\admin\includes\fieldset.html, error at line 19
context must be a dict rather than Context.
line 19 {{ field.field }}
My command in models.py
body = MarkdownField()
Please help me solve this error. I tried but I don't understand how has this error.
As far as I could see there is no way to protect myself from cross-site scripting with this extension, am I right? If so, the package documentation could at least need some warnings for users of this extension ...
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I am getting the following warning on django 1.10
/home/jza/.virtualenvs/ardorforum/local/lib/python2.7/site-packages/django_markdown/urls.py:8: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
'', url('preview/$', preview, name='django_markdown_preview'))
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I just tried to take a look at the example. I cloned the repo, created a new virtualenv (Python 3.4, Django 1.8) and started the example with python manage.py runserver
… it runs, but I forget to install the migrations. When I tried to apply them with python manage.py migrate
I get the following error:
django.db.utils.OperationalError: Problem installing fixture '/home/…/example/project/md/fixtures/initial_data.json': Could not load auth.Permission(pk=1): no such table: auth_permission
If I run the migrations without fixtures first: python manage.py migrate --no-initial-data
and after that, run it again with fixtures: python manage.py migrate
it seems to work. Despite Django raising an warning RemovedInDjango19Warning
because of the fixtures, it looks like they are loaded fine (got the root user).
But now I get 403 on previews when i hit the button on the example page? Don't know if it's related though.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/11872896-error-on-migrate-in-the-provided-example?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).Hello, I tried to install this library on Django 1.9 and got such error in admin interface when tried to run preview.
Internal Server Error: /markdown/preview/
Traceback (most recent call last):
File "/home/alexey/Dev/profcom/django-rest-env/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/alexey/Dev/profcom/django-rest-env/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/alexey/Dev/profcom/django-rest-env/lib/python3.4/site-packages/django_markdown/views.py", line 22, in preview
content=request.REQUEST.get('data', 'No content posted'),
AttributeError: 'WSGIRequest' object has no attribute 'REQUEST'
[10/Dec/2015 22:14:47] "POST /markdown/preview/ HTTP/1.1" 500 14951
Here is the model code
class Post(models.Model):
name = models.CharField(max_length=50, null=False, primary_key=True) # Name for human-readable url
title = models.CharField(max_length=255, null=False, unique=True) # Human-readable title
text = MarkdownField() # Text in markdown syntax
documents = models.ManyToManyField('Document', blank=True)
commission = models.ForeignKey('Commission', related_name="posts")
pinned = models.BooleanField(default=False) # Should display on main
date = models.DateTimeField(auto_now=True)
image = models.FileField(upload_to='post_tiles', null=True)
Is it compatible with django 1.9?
Thank you in advance!
Sinclerely, Alexey
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Markdown widget’s media i.e. javascript and stylesheets are not getting added in admin after explicitly defining form_overrides in Django 1.10
`class Entry(models.Model):
...
body = MarkdownField()
....
from django_markdown.widgets import AdminMarkdownWidget
from django_markdown.models import MarkdownField
class EntryAdmin(admin.ModelAdmin):
formfield_overrides = {MarkdownField: {'widget': AdminMarkdownWidget}}`
--user-mirrors has been deprecated.
Your settings.py has this line
STATIC_URL = settings.STATIC_URL or settings.MEDIA_URL
This causes issues where the editor will 404 if you have settings defined this way.
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = '/static/'
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = (
join(BASE_DIR, 'static'),
)
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
# END STATIC FILE CONFIGURATION
# MEDIA CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
MEDIA_ROOT = join(BASE_DIR, 'media')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
MEDIA_URL = '/media/'
because it will always evaluate to true. I would suggest dropping the setting or just setting it to
STATIC_URL = settings.STATIC_URL
MEDIA_URL = settings.MEDIA_URL
When I try to preview my markdown I got an error 500 with this response.
`Environment:
Request Method: GET
Request URL: http://localhost:8000/markdown/preview/
Django Version: 1.8.4
Python Version: 3.4.3
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
'django_markdown')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware')
Traceback:
File "/usr/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
content=request.REQUEST.get('data','No posted content'),
Exception Type: TypeError at /markdown/preview/
Exception Value: 'QueryDict' object is not callable`
Hi,
I'm using S3 + CloudFront for static content, and the django_markdown static url's have incorrect url's in Django Admin (I'm using Grapelli interface). I use the s3-storage-redux provider for S3 access.
This is the output in admin html:
<link href="content.headincloud.be/django_markdown/skins/simple/style.css" type="text/css" media="screen" rel="stylesheet" />
<link href="content.headincloud.be/django_markdown/sets/markdownextra/style.css" type="text/css" media="screen" rel="stylesheet" />
<script type="text/javascript" src="https://content.headincloud.be/static/admin/js/core.78280057239a.js"></script>
<script type="text/javascript" src="https://content.headincloud.be/static/admin/js/admin/RelatedObjectLookups.724e5c83a428.js"></script>
<script type="text/javascript" src="https://content.headincloud.be/static/admin/js/jquery.min.c1a27df1b997.js"></script>
<script type="text/javascript" src="https://content.headincloud.be/static/admin/js/jquery.init.c1a27df1b997.js"></script>
<script type="text/javascript" src="https://content.headincloud.be/static/admin/js/actions.min.7f64b3c51d67.js"></script>
<script type="text/javascript" src="content.headincloud.be/django_markdown/jquery.init.js"></script>
<script type="text/javascript" src="content.headincloud.be/django_markdown/jquery.markitup.js"></script>
<script type="text/javascript" src="content.headincloud.be/django_markdown/sets/markdownextra/set.js"></script>
Notice the absence of "https://".
I suspect you are using the STATIC_URL in settings directly somewhere, while you probably need to use the staticfiles template tags. Depending on STATIC_URL will probably make it incompatible with other storage providers for Django (like S3Storage, or even the built-in manifest storage provider).
Hello klen:
When I try to import url from markdown
RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
'', url('preview/$', preview, name='django_markdown_preview'))
I get this warning.
It time to release new version of django_markdown?
is there a way to localize the markdown pages?
Arising from this [stack overflow question](http://stackoverflow.com/questions/34588310/django-markdown-failed-to-show-preview-in-django-1-9/34588507#34588507 stack overflow question):
request.REQUEST was deprecated in Django 1.7, and removed in Django 1.9. The preview view needs to be updated to work with Django 1.9.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29567679-preview-view-uses-obsolete-request-request?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).django_markdown/urls.py:8: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
'', url('preview/$', preview, name='django_markdown_preview'))
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The icons from the editor toolbar are not visible if the server is running on Windows. This can be fixed by replacing calls to os.path.join
by posixpath.join
in widgets.py
We put three markdown fields on the same page, but only the first one get rendered. Does django_markdown support multiple fields? Thanks
I'm already using a custom admin. How can I assign the markdown widget directly to a model and have it show up in admin?
I think that something is missing in the README as I get "miu is not defined". Some javascript files are missing and in the README there's no clue of which ones.
It's not clear from the README.md
file whether Python 3 is supported or not.
Also, the setup.py
file should indicate whether it supports Python 3 like this:
'Programming Language :: Python :: 3',
Thanks!
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/31682680-document-python-3-compatibility?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).I am using 1.9 and I cannot get the formatted mardown text to show in my template, but it works correctly in the preview. I have followed all the instructions. Is this a 1.9 bug?
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30439782-preview-is-showing-correctly-but-the-django-is-rendering-plain-text-instead-of-markdown-formatted?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).Well, this is not an issue, it is a request. Should be possible add the count of words once rendered and show the total above or in the bottom of the rendering area
thanks
It would be nice to specify Markdown in the model:
from django_markdown.fields import MarkdownField
class Item(models.Model):
...
md = MarkdownField()
The README of the project points users to http://pythonhosted.org/django-markdown/changes.html in order to view the most recent changes, but this file only contains changes up to v0.1.0.
There is a file called ChangeLog.txt in the root of the repository, but the fact that it has a TXT extension means that Github does not display its ReStructuredText properly. It also contains the exact same information as the changelog in the package's documentation.
I would suggest:
I can create a pull request for these changes if you would like.
django 1.4
python 2.7.3
django-markdown==0.6.1
/lib/python2.7/site-packages/django_markdown/utils.py in , line 4 tries to call <force_text()> from django.utils.encoding which does not exist.
There is however a <force_unicode()>. using this seems to work at first glance.
please let me know if i can help out with any other info that might be usefull
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3563885-cannot-import-name-force_text?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).Uncaught TypeError: Cannot read property 'trim' of undefined set.js:45
miu.markdownTitle set.js:45
mySettings.markupSet.closeWith set.js:16
prepare jquery.markitup.js:282build jquery.markitup.js:292
markup jquery.markitup.js:384(anonymous function)
Hi,
I'm using the django-storages
app with the S3Storage as my static files backend.
It seems to me that django_markdown
is unable to fetch static files using the default backend.
Would've been a nice improvement.
Here Style means changing its Height, Width
The django.core.urlresolvers module is removed in favor of its new location, django.urls.
https://docs.djangoproject.com/en/2.0/releases/2.0/
Therefore, such an error:
ModuleNotFoundError: No module named 'django.core.urlresolvers'
when I try to make migration use: manage.py schemamition app_name --auto
and got the error like :
! Cannot freeze field 'app_name.model.field'
! (this field has class django_markdown.models.MarkdownField)
! South cannot introspect some fields; this is probably because they are custom
! fields. If they worked in 0.6 or below, this is because we have removed the
! models parser (it often broke things).
! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork
but I can't understand the solution which the link give.
wish help. Thanks. :)
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9014946-about-south?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).most of the time, people put js file at the end of the body tag, but you put js right after the form fields, so its very convenient that I have to put Jquery and markdown at the head
I'm following this tutorial and I've followed the guide exactly. Still I'm unable to get the MarkdownModelAdmin functionality working (MarkdownField for text entry and a preview of the formatted markdown in the admin panel).
There are others who have had the same problem and reported this in the youtube comments. One person suggests changing the TextField to a MarkdownField in the model, but this doesn't really seem like an optimal solution, since the preview functionality doesn't work.
Is this a bug or a feature and if it's a feature, how do I get this working?
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/7160080-unable-to-successfully-subclass-markdownmodeladmin?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).from django.conf.urls import patterns, url
app_1 | ImportError: cannot import name patterns
i'm using django 1.11
when i want used it in my django templates, i connected jqyery in base.hml, but when i go to page with mardowd_editor i see this error, but in django admin it work nice
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/34907624-jquery-is-not-define?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F332251&utm_medium=issues&utm_source=github).Closed
django.conf.urls.direct_to_template is no longer supported. We need to move to django.shortcuts.render.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.