Merge branch 'master' of http://210.77.77.77/xieshen/newmediamonitoring
This commit is contained in:
commit
43f392c73b
|
@ -46,19 +46,6 @@ INSTALLED_APPS = [
|
||||||
'management',
|
'management',
|
||||||
'monitor',
|
'monitor',
|
||||||
'polls',
|
'polls',
|
||||||
'wagtail.contrib.forms',
|
|
||||||
'wagtail.contrib.redirects',
|
|
||||||
'wagtail.embeds',
|
|
||||||
'wagtail.sites',
|
|
||||||
'wagtail.users',
|
|
||||||
'wagtail.snippets',
|
|
||||||
'wagtail.documents',
|
|
||||||
'wagtail.images',
|
|
||||||
'wagtail.search',
|
|
||||||
'wagtail.admin',
|
|
||||||
'wagtail.core',
|
|
||||||
'modelcluster',
|
|
||||||
'taggit',
|
|
||||||
'django_summernote',
|
'django_summernote',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -73,8 +60,6 @@ MIDDLEWARE = [
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'django_token.middleware.TokenMiddleware',
|
'django_token.middleware.TokenMiddleware',
|
||||||
'wagtail.core.middleware.SiteMiddleware',
|
|
||||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'NewMediaMonitoring.urls'
|
ROOT_URLCONF = 'NewMediaMonitoring.urls'
|
||||||
|
@ -172,8 +157,6 @@ SMS_ACCESS_KEY_ID = 'LTAIBfgqfC2fpIDF'
|
||||||
|
|
||||||
SMS_ACCESS_KEY_SECRET = 'ocBzC2UvguYbyR6coNGYdPiV5HdWbC'
|
SMS_ACCESS_KEY_SECRET = 'ocBzC2UvguYbyR6coNGYdPiV5HdWbC'
|
||||||
|
|
||||||
WAGTAIL_SITE_NAME = 'NewMediaMonitor'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .local_settings import *
|
from .local_settings import *
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
|
|
|
@ -3,15 +3,6 @@ import uuid
|
||||||
import datetime
|
import datetime
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from modelcluster.fields import ParentalKey, ParentalManyToManyField
|
|
||||||
|
|
||||||
from wagtail.core.models import Page, Orderable
|
|
||||||
from wagtail.core.models import Page
|
|
||||||
from wagtail.core.fields import RichTextField
|
|
||||||
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
|
|
||||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
|
||||||
from wagtail.snippets.models import register_snippet
|
|
||||||
|
|
||||||
|
|
||||||
from dashboard.models import Group
|
from dashboard.models import Group
|
||||||
|
|
||||||
|
@ -109,56 +100,3 @@ class MessageRecord(models.Model):
|
||||||
|
|
||||||
class ChatRecord(models.Model):
|
class ChatRecord(models.Model):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NewsPage(Page):
|
|
||||||
date = models.DateField("Post date")
|
|
||||||
source = models.CharField(max_length=64)
|
|
||||||
intro = models.CharField(max_length=250)
|
|
||||||
body = RichTextField(blank=True)
|
|
||||||
categories = ParentalManyToManyField('polls.NewsCategory', blank=True)
|
|
||||||
|
|
||||||
def main_image(self):
|
|
||||||
gallery_item = self.gallery_images.first()
|
|
||||||
if gallery_item:
|
|
||||||
return gallery_item.image
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
content_panels = Page.content_panels + [
|
|
||||||
FieldPanel('date'),
|
|
||||||
FieldPanel('source'),
|
|
||||||
FieldPanel('categories'),
|
|
||||||
FieldPanel('intro'),
|
|
||||||
FieldPanel('body', classname="full"),
|
|
||||||
InlinePanel('gallery_images', label="Gallery images"),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class NewsPageGalleryImage(Orderable):
|
|
||||||
page = ParentalKey(NewsPage, on_delete=models.CASCADE,
|
|
||||||
related_name='gallery_images')
|
|
||||||
image = models.ForeignKey(
|
|
||||||
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
|
|
||||||
)
|
|
||||||
caption = models.CharField(blank=True, max_length=250)
|
|
||||||
|
|
||||||
panels = [
|
|
||||||
ImageChooserPanel('image'),
|
|
||||||
FieldPanel('caption'),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@register_snippet
|
|
||||||
class NewsCategory(models.Model):
|
|
||||||
name = models.CharField(max_length=255)
|
|
||||||
|
|
||||||
panels = [
|
|
||||||
FieldPanel('name'),
|
|
||||||
]
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
verbose_name_plural = 'news categories'
|
|
||||||
|
|
|
@ -7,5 +7,4 @@ aliyun-python-sdk-core-v3
|
||||||
channels
|
channels
|
||||||
requests
|
requests
|
||||||
parsel
|
parsel
|
||||||
wagtail
|
|
||||||
django-summernote
|
django-summernote
|
||||||
|
|
Loading…
Reference in New Issue