django天天生鲜项目

.后台admin管理天天生鲜商品信息

models里

from django.db import models
from tinymce.models import HTMLField #需要pip安装tinymce包
# Create your models here.

class GoodTest(models.Model):
STATIC_CHOICES = ((0, '下架'), (1, '上架'))
status = models.SmallIntegerField(choices=STATIC_CHOICES, verbose_name='商品状态')
detail = HTMLField(verbose_name='商品详情')

主urls里
urlpatterns = [
url('admin/', admin.site.urls),
url('test/', include('app01.urls')),
url('tinymce', include('tinymce.urls'))
]

admin里
from django.contrib import admin
from app01.models import GoodTest
# Register your models here.
admin.site.register(GoodTest)

settings里最下方添加
TINYMCE_DEFAULT_CONFIG = {
'theme': 'advanced',
'width': 600,
'height': 400
}


以上三部完成后效果图如下:

django天天生鲜项目_第1张图片

 

 

 

 
  

转载于:https://www.cnblogs.com/fengzi7314/p/9640105.html

你可能感兴趣的:(django天天生鲜项目)