Skip to content

Commit ed7753b

Browse files
authored
Merge pull request liangliangyy#227 from liangliangyy/dev
替换markdown编辑器 close liangliangyy#216 close liangliangyy#224
2 parents ae769f9 + 157af06 commit ed7753b

File tree

7 files changed

+40
-29
lines changed

7 files changed

+40
-29
lines changed

DjangoBlog/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
'django.contrib.staticfiles',
4545
'django.contrib.sites',
4646
'django.contrib.sitemaps',
47-
'pagedown',
47+
'mdeditor',
4848
'haystack',
4949
'blog',
5050
'accounts',
@@ -284,3 +284,7 @@
284284
COMPRESS_JS_FILTERS = [
285285
'compressor.filters.jsmin.JSMinFilter'
286286
]
287+
288+
289+
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
290+
MEDIA_URL = '/media/'

DjangoBlog/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from django.conf import settings
2323
from django.conf.urls.static import static
2424
from DjangoBlog.admin_site import admin_site
25+
from django.urls import include, path
2526

2627
sitemaps = {
2728

@@ -38,7 +39,7 @@
3839
urlpatterns = [
3940
url(r'^admin/', admin_site.urls),
4041
url(r'', include('blog.urls', namespace='blog')),
41-
42+
url(r'mdeditor/', include('mdeditor.urls')),
4243
url(r'', include('comments.urls', namespace='comment')),
4344
url(r'', include('accounts.urls', namespace='account')),
4445
url(r'', include('oauth.urls', namespace='oauth')),

blog/admin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from django.contrib import admin
22
# Register your models here.
33
from .models import Article, Category, Tag, Links, SideBar, BlogSettings
4-
from pagedown.widgets import AdminPagedownWidget
54
from django import forms
65
from django.contrib.auth import get_user_model
76
from django.utils.translation import ugettext_lazy as _
@@ -27,7 +26,7 @@ def queryset(self, request, queryset):
2726

2827

2928
class ArticleForm(forms.ModelForm):
30-
body = forms.CharField(widget=AdminPagedownWidget())
29+
# body = forms.CharField(widget=AdminPagedownWidget())
3130

3231
class Meta:
3332
model = Article

blog/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from DjangoBlog.utils import cache_decorator, cache
1212
from django.utils.functional import cached_property
1313
from django.utils.timezone import now
14+
from mdeditor.fields import MDTextField
1415

1516
logger = logging.getLogger(__name__)
1617

@@ -67,7 +68,7 @@ class Article(BaseModel):
6768
('p', '页面'),
6869
)
6970
title = models.CharField('标题', max_length=200, unique=True)
70-
body = models.TextField('正文')
71+
body = MDTextField('正文')
7172
pub_time = models.DateTimeField('发布时间', blank=True, null=True)
7273
status = models.CharField('文章状态', max_length=1, choices=STATUS_CHOICES, default='p')
7374
comment_status = models.CharField('评论状态', max_length=1, choices=COMMENT_STATUS, default='o')

requirements.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
appdirs==1.4.3
22
asn1crypto==0.24.0
3-
astroid==2.1.0
3+
astroid==2.2.5
44
bottle==0.12.16
5-
certifi==2018.11.29
6-
cffi==1.11.5
5+
certifi==2019.3.9
6+
cffi==1.12.2
77
chardet==3.0.4
88
coverage==4.5.2
9-
cryptography==2.5
9+
cryptography==2.6.1
1010
Django==2.1.7
11-
django-appconf==1.0.2
11+
django-appconf==1.0.3
1212
django-autoslug==1.9.4
1313
django-compressor==2.2
1414
django-debug-toolbar==1.11
1515
django-haystack==2.8.1
1616
django-ipware==2.1.0
17-
django-pagedown==1.0.6
17+
django-mdeditor==0.1.13
1818
django-uuslug==1.1.8
1919
idna==2.8
20-
isort==4.3.4
20+
isort==4.3.14
2121
jieba==0.39
2222
jsonpickle==1.1
2323
lazy-object-proxy==1.3.1
@@ -29,22 +29,24 @@ packaging==19.0
2929
Pillow==5.4.1
3030
pycparser==2.19
3131
Pygments==2.3.1
32-
pylint==2.2.2
32+
pylint==2.3.1
3333
PyMySQL==0.9.3
3434
pyparsing==2.3.1
3535
python-memcached==1.59
36-
python-slugify==2.0.1
36+
python-slugify==3.0.0
3737
pytz==2018.9
3838
raven==6.10.0
3939
rcssmin==1.0.6
4040
requests==2.21.0
41-
rjsmin==1.0.12
41+
rjsmin==1.1.0
4242
six==1.12.0
4343
sqlparse==0.2.4
44+
text-unidecode==1.2
45+
typed-ast==1.3.1
4446
Unidecode==1.0.23
4547
urllib3==1.24.1
4648
webencodings==0.5.1
47-
WeRoBot==1.7.0
49+
WeRoBot==1.8.0
4850
Whoosh==2.7.4
4951
wrapt==1.11.1
5052
xmltodict==0.12.0

travis_test/requirements.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
appdirs==1.4.3
22
asn1crypto==0.24.0
3-
astroid==2.1.0
3+
astroid==2.2.5
44
bottle==0.12.16
5-
certifi==2018.11.29
6-
cffi==1.11.5
5+
certifi==2019.3.9
6+
cffi==1.12.2
77
chardet==3.0.4
88
coverage==4.5.2
9-
cryptography==2.5
9+
cryptography==2.6.1
1010
Django==2.1.7
11-
django-appconf==1.0.2
11+
django-appconf==1.0.3
1212
django-autoslug==1.9.4
1313
django-compressor==2.2
1414
django-debug-toolbar==1.11
1515
django-haystack==2.8.1
1616
django-ipware==2.1.0
17-
django-pagedown==1.0.6
17+
django-mdeditor==0.1.13
1818
django-uuslug==1.1.8
1919
idna==2.8
20-
isort==4.3.4
20+
isort==4.3.14
2121
jieba==0.39
2222
jsonpickle==1.1
2323
lazy-object-proxy==1.3.1
@@ -29,21 +29,23 @@ packaging==19.0
2929
Pillow==5.4.1
3030
pycparser==2.19
3131
Pygments==2.3.1
32-
pylint==2.2.2
32+
pylint==2.3.1
3333
PyMySQL==0.9.3
3434
pyparsing==2.3.1
35-
python-slugify==2.0.1
35+
python-slugify==3.0.0
3636
pytz==2018.9
3737
raven==6.10.0
3838
rcssmin==1.0.6
3939
requests==2.21.0
40-
rjsmin==1.0.12
40+
rjsmin==1.1.0
4141
six==1.12.0
4242
sqlparse==0.2.4
43+
text-unidecode==1.2
44+
typed-ast==1.3.1
4345
Unidecode==1.0.23
4446
urllib3==1.24.1
4547
webencodings==0.5.1
46-
WeRoBot==1.7.0
48+
WeRoBot==1.8.0
4749
Whoosh==2.7.4
4850
wrapt==1.11.1
4951
xmltodict==0.12.0

travis_test/travis_settings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@
3232
ALLOWED_HOSTS = ['www.lylinux.net', '127.0.0.1', 'example.com']
3333
# Application definition
3434

35+
3536
INSTALLED_APPS = [
36-
'django.contrib.admin',
37+
# 'django.contrib.admin',
38+
'django.contrib.admin.apps.SimpleAdminConfig',
3739
'django.contrib.auth',
3840
'django.contrib.contenttypes',
3941
'django.contrib.sessions',
4042
'django.contrib.messages',
4143
'django.contrib.staticfiles',
4244
'django.contrib.sites',
4345
'django.contrib.sitemaps',
44-
'pagedown',
46+
'mdeditor',
4547
'haystack',
4648
'blog',
4749
'accounts',

0 commit comments

Comments
 (0)