-
-
Notifications
You must be signed in to change notification settings - Fork 989
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #720 -- Added bio/website fields for DSF members.
- Loading branch information
Showing
12 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ | |
|
||
'registration', | ||
'django_hosts', | ||
'markdownx', | ||
'sorl.thumbnail', | ||
|
||
'django.contrib.sites', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# 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 | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('members', '0006_team'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='individualmember', | ||
name='bio', | ||
field=markdownx.models.MarkdownxField(blank=True), | ||
), | ||
migrations.AddField( | ||
model_name='individualmember', | ||
name='website', | ||
field=models.URLField(blank=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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', 'strong', 'ul'), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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, | ||
'<p>Line</p>\n<p><a href="https://www.djangoproject.com">Link</a></p>', | ||
) | ||
self.assertIsInstance(result, SafeData) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters