From d77416125aafba5478252281ce179b78cc44e353 Mon Sep 17 00:00:00 2001 From: baoliang Date: Sun, 13 Sep 2020 17:30:14 +0800 Subject: [PATCH] remove wagtial --- NewMediaMonitoring/settings.py | 17 ---------- polls/models.py | 62 ---------------------------------- requirements.txt | 1 - 3 files changed, 80 deletions(-) diff --git a/NewMediaMonitoring/settings.py b/NewMediaMonitoring/settings.py index 6a98cea..da4bf49 100644 --- a/NewMediaMonitoring/settings.py +++ b/NewMediaMonitoring/settings.py @@ -46,19 +46,6 @@ INSTALLED_APPS = [ 'management', 'monitor', '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', ] @@ -73,8 +60,6 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django_token.middleware.TokenMiddleware', - 'wagtail.core.middleware.SiteMiddleware', - 'wagtail.contrib.redirects.middleware.RedirectMiddleware', ] ROOT_URLCONF = 'NewMediaMonitoring.urls' @@ -172,8 +157,6 @@ SMS_ACCESS_KEY_ID = 'LTAIBfgqfC2fpIDF' SMS_ACCESS_KEY_SECRET = 'ocBzC2UvguYbyR6coNGYdPiV5HdWbC' -WAGTAIL_SITE_NAME = 'NewMediaMonitor' - try: from .local_settings import * except ImportError as e: diff --git a/polls/models.py b/polls/models.py index b71a8b5..81fd37a 100644 --- a/polls/models.py +++ b/polls/models.py @@ -3,15 +3,6 @@ import uuid import datetime from django.contrib.auth.models import User 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 @@ -109,56 +100,3 @@ class MessageRecord(models.Model): class ChatRecord(models.Model): 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' diff --git a/requirements.txt b/requirements.txt index 362de39..0153646 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,4 @@ aliyun-python-sdk-core-v3 channels requests parsel -wagtail django-summernote