From 5f2c45006063be2f17ea41430f55d7bf8368f901 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 1 Oct 2018 11:31:33 -0400 Subject: [PATCH] Reverted "Refs #720 -- Added bio/website fields for DSF members." This reverts commit c3128f1bc9f37c9d9d8717cb511d00bc5bb9312f as it's unused since 4a3cd803acbc03133cee9b0ca824c5b3d039e9fd. --- djangoproject/settings/common.py | 1 - .../members/individualmember_list.html | 2 +- djangoproject/test_markdownx.py | 20 ------------------ djangoproject/urls/www.py | 3 --- members/admin.py | 3 +-- members/migrations/0007_auto_20170216_0837.py | 3 +-- members/migrations/0008_auto_20181001_1031.py | 21 +++++++++++++++++++ members/models.py | 10 --------- members/templatetags/__init__.py | 0 members/templatetags/markdown.py | 19 ----------------- members/test_models.py | 7 ------- members/test_templatetags.py | 14 ------------- requirements/common.txt | 2 -- 13 files changed, 24 insertions(+), 81 deletions(-) delete mode 100644 djangoproject/test_markdownx.py create mode 100644 members/migrations/0008_auto_20181001_1031.py delete mode 100644 members/templatetags/__init__.py delete mode 100644 members/templatetags/markdown.py delete mode 100644 members/test_templatetags.py diff --git a/djangoproject/settings/common.py b/djangoproject/settings/common.py index a23b17d4c..59886ee0f 100644 --- a/djangoproject/settings/common.py +++ b/djangoproject/settings/common.py @@ -70,7 +70,6 @@ 'registration', 'django_hosts', - 'markdownx', 'sorl.thumbnail', 'django.contrib.sites', diff --git a/djangoproject/templates/members/individualmember_list.html b/djangoproject/templates/members/individualmember_list.html index 8ee097dcb..f316ad303 100644 --- a/djangoproject/templates/members/individualmember_list.html +++ b/djangoproject/templates/members/individualmember_list.html @@ -1,5 +1,5 @@ {% extends "base_foundation.html" %} -{% load i18n markdown %} +{% load i18n %} {% block content %}

{% trans "Individual members" %}

diff --git a/djangoproject/test_markdownx.py b/djangoproject/test_markdownx.py deleted file mode 100644 index a9bfe1dd9..000000000 --- a/djangoproject/test_markdownx.py +++ /dev/null @@ -1,20 +0,0 @@ -from django.contrib.auth.models import User -from django.test import TestCase - - -class TestPermissions(TestCase): - url = '/markdownx/markdownify/' - - def test_anonymous(self): - response = self.client.get(self.url) - self.assertEqual(response.status_code, 302) - - def test_staff_required(self): - user = User.objects.create(username='test') - self.client.force_login(user) - response = self.client.get(self.url) - self.assertEqual(response.status_code, 302) - user.is_staff = True - user.save() - response = self.client.get(self.url) - self.assertEqual(response.status_code, 405) diff --git a/djangoproject/urls/www.py b/djangoproject/urls/www.py index e532c44fb..02f137a1c 100644 --- a/djangoproject/urls/www.py +++ b/djangoproject/urls/www.py @@ -1,6 +1,5 @@ from django.conf import settings from django.contrib import admin -from django.contrib.admin.views.decorators import staff_member_required from django.contrib.auth import views as auth_views from django.contrib.contenttypes import views as contenttypes_views from django.contrib.flatpages.sitemaps import FlatPageSitemap @@ -9,7 +8,6 @@ from django.views.decorators.cache import cache_page from django.views.generic import RedirectView, TemplateView from django.views.static import serve -from markdownx.views import MarkdownifyView from accounts import views as account_views from aggregator.feeds import ( @@ -55,7 +53,6 @@ path('contact/', include('contact.urls')), path('foundation/', include('members.urls')), path('fundraising/', include('fundraising.urls')), - path('markdownx/markdownify/', staff_member_required(MarkdownifyView.as_view())), # Used by docs search suggestions re_path('^r/(?P\d+)/(?P.*)/$', contenttypes_views.shortcut, name='contenttypes-shortcut'), diff --git a/members/admin.py b/members/admin.py index 1d6beb433..548706b03 100644 --- a/members/admin.py +++ b/members/admin.py @@ -4,13 +4,12 @@ from django.templatetags.static import static from django.utils.formats import localize from django.utils.html import format_html -from markdownx.admin import MarkdownxModelAdmin from members.models import CorporateMember, IndividualMember, Invoice, Team @admin.register(IndividualMember) -class IndividualMemberAdmin(MarkdownxModelAdmin): +class IndividualMemberAdmin(admin.ModelAdmin): list_display = [ 'name', 'email', diff --git a/members/migrations/0007_auto_20170216_0837.py b/members/migrations/0007_auto_20170216_0837.py index c69cf1aa1..39d4b7c25 100644 --- a/members/migrations/0007_auto_20170216_0837.py +++ b/members/migrations/0007_auto_20170216_0837.py @@ -2,7 +2,6 @@ # Generated by Django 1.10.5 on 2017-02-16 08:37 from __future__ import unicode_literals -import markdownx.models from django.db import migrations, models @@ -16,7 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='individualmember', name='bio', - field=markdownx.models.MarkdownxField(blank=True), + field=models.TextField(blank=True), ), migrations.AddField( model_name='individualmember', diff --git a/members/migrations/0008_auto_20181001_1031.py b/members/migrations/0008_auto_20181001_1031.py new file mode 100644 index 000000000..acfd5c3ad --- /dev/null +++ b/members/migrations/0008_auto_20181001_1031.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.2 on 2018-10-01 10:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('members', '0007_auto_20170216_0837'), + ] + + operations = [ + migrations.RemoveField( + model_name='individualmember', + name='bio', + ), + migrations.RemoveField( + model_name='individualmember', + name='website', + ), + ] diff --git a/members/models.py b/members/models.py index dfaae9b56..aa834c87f 100644 --- a/members/models.py +++ b/members/models.py @@ -4,10 +4,8 @@ from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver -from django.utils.html import format_html from django.views.generic.dates import timezone_today from django_hosts import reverse -from markdownx.models import MarkdownxField from sorl.thumbnail import ImageField, get_thumbnail BRONZE_MEMBERSHIP = 1 @@ -41,8 +39,6 @@ class IndividualMember(models.Model): member_since = models.DateField(default=timezone_today) member_until = models.DateField(null=True, blank=True) reason_for_leaving = models.TextField(blank=True) - bio = MarkdownxField(blank=True) - website = models.URLField(blank=True) class Meta: ordering = ['name'] @@ -54,12 +50,6 @@ def __str__(self): def is_active(self): return self.member_until is None - @property - def linked_name(self): - if self.website: - return format_html('{}', self.website, self.name) - return self.name - class Team(models.Model): name = models.CharField(max_length=250) diff --git a/members/templatetags/__init__.py b/members/templatetags/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/members/templatetags/markdown.py b/members/templatetags/markdown.py deleted file mode 100644 index a4310e474..000000000 --- a/members/templatetags/markdown.py +++ /dev/null @@ -1,19 +0,0 @@ -import bleach -import markdown -from django import template -from django.utils.safestring import mark_safe - -register = template.Library() - - -@register.filter(is_safe=True) -def markdownify(text): - return mark_safe( - bleach.clean( - markdown.markdown(text, output_format='html5'), - tags=( - 'a', 'abbr', 'acronym', 'b', 'blockquote', 'em', 'i', 'li', - 'ol', 'p', 'sup', 'strong', 'ul', - ), - ) - ) diff --git a/members/test_models.py b/members/test_models.py index 04f97a87d..ce74a8379 100644 --- a/members/test_models.py +++ b/members/test_models.py @@ -1,7 +1,6 @@ from datetime import date, timedelta from django.test import TestCase -from django.utils.safestring import SafeData from members.models import ( GOLD_MEMBERSHIP, PLATINUM_MEMBERSHIP, SILVER_MEMBERSHIP, CorporateMember, @@ -24,12 +23,6 @@ def setUp(self): def test_str(self): self.assertEqual(str(self.member), 'DjangoDeveloper') - def test_linked_name(self): - self.assertEqual(self.member.linked_name, 'DjangoDeveloper') - self.member.website = 'djangoproject.com' - self.assertEqual(self.member.linked_name, 'DjangoDeveloper') - self.assertIsInstance(self.member.linked_name, SafeData) - def test_member_since_should_have_default(self): self.assertEqual(IndividualMember().member_since, date.today()) diff --git a/members/test_templatetags.py b/members/test_templatetags.py deleted file mode 100644 index 0e1d2b90c..000000000 --- a/members/test_templatetags.py +++ /dev/null @@ -1,14 +0,0 @@ -from django.test import SimpleTestCase -from django.utils.safestring import SafeData - -from .templatetags.markdown import markdownify - - -class MarkdownifyTests(SimpleTestCase): - def test_str(self): - result = markdownify('Line\n\n[Link](https://www.djangoproject.com)') - self.assertEqual( - result, - '

Line

\n

Link

', - ) - self.assertIsInstance(result, SafeData) diff --git a/requirements/common.txt b/requirements/common.txt index e5a5190dd..bc2725f3c 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -2,14 +2,12 @@ bleach==2.1.4 Django==2.1.2 django-contact-form==1.6 django-hosts==3.0 -django-markdownx==2.0.23 django-push==1.1 django-registration-redux==2.4 docutils==0.14 feedparser==5.2.1 Jinja2==2.10 libsass==0.15.0 -Markdown==2.6.11 Pillow==5.3.0 psycopg2-binary==2.7.5 pygments==2.2.0