models.py 745 B

1234567891011121314151617181920
  1. #coding:utf-8
  2. #
  3. from django.db import models
  4. from DjangoUeditor.models import UEditorField
  5. def getImagePath(model_instance=None):
  6. if model_instance is None:
  7. return "aaa/"
  8. else:
  9. return "%s/" % model_instance.Name
  10. def getDescImagePath(model_instance=None):
  11. return "aaa/"
  12. class Blog(models.Model):
  13. Name=models.CharField('姓名',max_length=100,blank=True)
  14. Description=UEditorField('描述',blank=True,toolbars="full")
  15. ImagePath=models.CharField('图片目录',max_length=100,blank=True)
  16. Content=UEditorField('内容',height=200,width=500,default='test',imagePath=getImagePath,imageManagerPath="bb",toolbars="mini",options={"elementPathEnabled":True},filePath='bb',blank=True)