Skip to content

Commit

Permalink
Merge 7178943 into 9a4a653
Browse files Browse the repository at this point in the history
  • Loading branch information
KatherineMichel committed Jan 8, 2018
2 parents 9a4a653 + 7178943 commit 9c1455e
Show file tree
Hide file tree
Showing 13 changed files with 291 additions and 113 deletions.
96 changes: 96 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
version: 2.0

common: &common
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v2-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- v2-deps-
- run:
name: install dependencies
command: pip install --user tox
- run:
name: run tox
command: ~/.local/bin/tox
- run:
name: upload coverage report
command: |
if [[ "$UPLOAD_COVERAGE" != 0 ]]; then
PATH=$HOME/.local/bin:$PATH
pip install --user codecov
coverage xml
~/.local/bin/codecov --required -X search gcov pycov -f coverage.xml --flags $CIRCLE_JOB
fi
- save_cache:
paths:
- .tox
- ~/.cache/pip
- ~/.local
- ./eggs
key: v2-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}

jobs:
lint:
<<: *common
docker:
- image: circleci/python:3.6.1
environment:
- TOXENV=checkqa
- UPLOAD_COVERAGE=0
py27dj111:
<<: *common
docker:
- image: circleci/python:2.7
environment:
TOXENV=py27-dj111
py34dj111:
<<: *common
docker:
- image: circleci/python:3.4
environment:
TOXENV=py34-dj111
py34dj20:
<<: *common
docker:
- image: circleci/python:3.4
environment:
TOXENV=py34-dj20
py35dj111:
<<: *common
docker:
- image: circleci/python:3.5
environment:
TOXENV=py35-dj111
py35dj20:
<<: *common
docker:
- image: circleci/python:3.5
environment:
TOXENV=py35-dj20
py36dj111:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV=py36-dj111
py36dj20:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV=py36-dj20

workflows:
version: 2
test:
jobs:
- lint
- py27dj111
- py34dj111
- py34dj20
- py35dj111
- py35dj20
- py36dj111
- py36dj20
20 changes: 9 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
MANIFEST
.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
docs/_build/
eggs/
lib/
lib64/
Expand All @@ -23,6 +23,11 @@ var/
.installed.cfg
*.egg
*.eggs
.python-version

# Pipfile
Pipfile
Pipfile.lock

# Installer logs
pip-log.txt
Expand All @@ -36,12 +41,5 @@ htmlcov/
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# MkDocs
site/
# IDEs
.idea/
86 changes: 63 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,62 @@
![](http://pinaxproject.com/pinax-design/patches/pinax-forums.svg)

# Pinax Forums

[![](http://slack.pinaxproject.com/badge.svg)](http://slack.pinaxproject.com/)
[![](https://img.shields.io/travis/pinax/pinax-forums.svg)](https://travis-ci.org/pinax/pinax-forums)
[![](https://img.shields.io/coveralls/pinax/pinax-forums.svg)](https://coveralls.io/r/pinax/pinax-forums)
[![](https://img.shields.io/pypi/dm/pinax-forums.svg)](https://pypi.python.org/pypi/pinax-forums/)
[![](https://img.shields.io/pypi/v/pinax-forums.svg)](https://pypi.python.org/pypi/pinax-forums/)
[![](https://img.shields.io/badge/license-MIT-blue.svg)](https://pypi.python.org/pypi/pinax-forums/)

## Pinax
[![CircleCi](https://img.shields.io/circleci/project/github/pinax/pinax-forums.svg)](https://circleci.com/gh/pinax/pinax-forums)
[![Codecov](https://img.shields.io/codecov/c/github/pinax/pinax-forums.svg)](https://codecov.io/gh/pinax/pinax-forums)
[![](https://img.shields.io/github/contributors/pinax/pinax-forums.svg)](https://github.com/pinax/pinax-forums/graphs/contributors)
[![](https://img.shields.io/github/issues-pr/pinax/pinax-forums.svg)](https://github.com/pinax/pinax-forums/pulls)
[![](https://img.shields.io/github/issues-pr-closed/pinax/pinax-forums.svg)](https://github.com/pinax/pinax-forums/pulls?q=is%3Apr+is%3Aclosed)

[![](http://slack.pinaxproject.com/badge.svg)](http://slack.pinaxproject.com/)
[![](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)


Pinax is an open-source platform built on the Django Web Framework. It is an
ecosystem of reusable Django apps, themes, and starter project templates.
This collection can be found at http://pinaxproject.com.
## Table of Contents

This app was developed as part of the Pinax ecosystem but is just a Django app
and can be used independently of other Pinax apps.
* [About Pinax](#about-pinax)
* [Overview](#overview)
* [Supported Django and Python versions](#supported-django-and-python-versions)
* [Change Log](#change-log)
* [History](#history)
* [Contribute](#contribute)
* [Code of Conduct](#code-of-conduct)
* [Connect with Pinax](#connect-with-pinax)
* [License](#license)

## About Pinax

Pinax is an open-source platform built on the Django Web Framework. It is an ecosystem of reusable
Django apps, themes, and starter project templates. This collection can be found at http://pinaxproject.com.

## pinax-forums

### Overview

`pinax-forums` is an extensible forums app for Django and Pinax. It is focused
on core forum functionality and hence is expected to be combined with other
Pinax apps for broader features.

#### Supported Django and Python versions

Django \ Python | 2.7 | 3.4 | 3.5 | 3.6
--------------- | --- | --- | --- | ---
1.11 | * | * | * | *
2.0 | | * | * | *


## Change Log

### 1.0.0

* Add Django 2.0 compatibility testing
* Drop Django 1.8, 1.9, 1.10, and Python 3.3 support
* Move documentation into README and standardize layout
* Convert CI and coverage to CircleCi and CodeCov
* Add PyPi-compatible long description


## History

Expand All @@ -32,27 +66,33 @@ The clients were kind enough to allow Eldarion to open source the app and
contribute it to Pinax.


## Documentation
## Contribute

The `pinax-forums` documentation is currently under construction. If you would
like to help us write documentation, please join our Pinax Project Slack team
and let us know! The Pinax documentation is available at http://pinaxproject.com/pinax/.
For an overview on how contributing to Pinax works read this [blog post](http://blog.pinaxproject.com/2016/02/26/recap-february-pinax-hangout/)
and watch the included video, or read our [How to Contribute](http://pinaxproject.com/pinax/how_to_contribute/) section.
For concrete contribution ideas, please see our
[Ways to Contribute/What We Need Help With](http://pinaxproject.com/pinax/ways_to_contribute/) section.

In case of any questions we recommend you join our [Pinax Slack team](http://slack.pinaxproject.com)
and ping us there instead of creating an issue on GitHub. Creating issues on GitHub is of course
also valid but we are usually able to help you faster if you ping us in Slack.

## Contribute
We also highly recommend reading our blog post on [Open Source and Self-Care](http://blog.pinaxproject.com/2016/01/19/open-source-and-self-care/).

See [this blog post](http://blog.pinaxproject.com/2016/02/26/recap-february-pinax-hangout/) including a video, or our [How to Contribute](http://pinaxproject.com/pinax/how_to_contribute/) section for an overview on how contributing to Pinax works. For concrete contribution ideas, please see our [Ways to Contribute/What We Need Help With](http://pinaxproject.com/pinax/ways_to_contribute/) section.

In case of any questions we recommend you [join our Pinax Slack team](http://slack.pinaxproject.com) and ping us there instead of creating an issue on GitHub. Creating issues on GitHub is of course also valid but we are usually able to help you faster if you ping us in Slack.
## Code of Conduct

We also highly recommend reading our [Open Source and Self-Care blog post](http://blog.pinaxproject.com/2016/01/19/open-source-and-self-care/).
In order to foster a kind, inclusive, and harassment-free community, the Pinax Project
has a [code of conduct](http://pinaxproject.com/pinax/code_of_conduct/).
We ask you to treat everyone as a smart human programmer that shares an interest in Python, Django, and Pinax with you.


## Code of Conduct
## Connect with Pinax

In order to foster a kind, inclusive, and harassment-free community, the Pinax Project has a code of conduct, which can be found [here](http://pinaxproject.com/pinax/code_of_conduct/). We ask you to treat everyone as a smart human programmer that shares an interest in Python, Django, and Pinax with you.
For updates and news regarding the Pinax Project, please follow us on Twitter [@pinaxproject](https://twitter.com/pinaxproject)
and check out our [Pinax Project blog](http://blog.pinaxproject.com).


## Pinax Project Blog and Twitter
## License

For updates and news regarding the Pinax Project, please follow us on Twitter at @pinaxproject and check out our [blog]( http://blog.pinaxproject.com).
Copyright (c) 2012-2018 James Tauber and contributors under the [MIT license](https://opensource.org/licenses/MIT).
2 changes: 1 addition & 1 deletion pinax/forums/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms

from .models import ForumThread, ForumReply
from .models import ForumReply, ForumThread


class PostForm(object):
Expand Down
2 changes: 1 addition & 1 deletion pinax/forums/hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.html import urlize, linebreaks, escape, conditional_escape
from django.utils.html import conditional_escape, escape, linebreaks, urlize
from django.utils.safestring import mark_safe

from .conf import settings
Expand Down
24 changes: 12 additions & 12 deletions pinax/forums/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import datetime
import json

from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible

from django.contrib.auth import get_user_model

from .conf import settings
from .managers import ForumThreadManager
from .hooks import hookset
from .managers import ForumThreadManager


# this is the glue to the activity events framework, provided as a no-op here
Expand All @@ -24,7 +23,7 @@ def issue_update(kind, **kwargs):
class ForumCategory(models.Model):

title = models.CharField(max_length=100)
parent = models.ForeignKey("self", null=True, blank=True, related_name="subcategories")
parent = models.ForeignKey("self", null=True, blank=True, related_name="subcategories", on_delete=models.CASCADE)

# @@@ total descendant forum count?
# @@@ make group-aware
Expand Down Expand Up @@ -55,7 +54,8 @@ class Forum(models.Model):
"self",
null=True,
blank=True,
related_name="subforums"
related_name="subforums",
on_delete=models.CASCADE
)
category = models.ForeignKey(
ForumCategory,
Expand Down Expand Up @@ -239,7 +239,7 @@ def restore(cls, in_):

class ForumPost(models.Model):

author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="%(app_label)s_%(class)s_related")
author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="%(app_label)s_%(class)s_related", on_delete=models.CASCADE)
content = models.TextField()
content_html = models.TextField()
created = models.DateTimeField(default=timezone.now, editable=False)
Expand All @@ -265,7 +265,7 @@ class ForumThread(ForumPost):
# used for code that needs to know the kind of post this object is.
kind = "thread"

forum = models.ForeignKey(Forum, related_name="threads")
forum = models.ForeignKey(Forum, related_name="threads", on_delete=models.CASCADE)
title = models.CharField(max_length=100)
last_modified = models.DateTimeField(
default=timezone.now,
Expand Down Expand Up @@ -356,7 +356,7 @@ class ForumReply(ForumPost):
# used for code that needs to know the kind of post this object is.
kind = "reply"

thread = models.ForeignKey(ForumThread, related_name="replies")
thread = models.ForeignKey(ForumThread, related_name="replies", on_delete=models.CASCADE)

class Meta:
verbose_name = "forum reply"
Expand All @@ -365,7 +365,7 @@ class Meta:

class UserPostCount(models.Model):

user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="post_count")
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="post_count", on_delete=models.CASCADE)
count = models.IntegerField(default=0)

@classmethod
Expand All @@ -388,8 +388,8 @@ def calculate(cls):

class ThreadSubscription(models.Model):

thread = models.ForeignKey(ForumThread, related_name="subscriptions")
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="forum_subscriptions")
thread = models.ForeignKey(ForumThread, related_name="subscriptions", on_delete=models.CASCADE)
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="forum_subscriptions", on_delete=models.CASCADE)
kind = models.CharField(max_length=15)

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion pinax/forums/receivers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver

from .models import ForumThread, ForumReply, ThreadSubscription, UserPostCount
from .models import ForumReply, ForumThread, ThreadSubscription, UserPostCount


@receiver(post_save, sender=ForumThread)
Expand Down
3 changes: 1 addition & 2 deletions pinax/forums/templatetags/pinax_forums_tags.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django import template
from django.core.urlresolvers import reverse
from django.urls import reverse

from ..models import ThreadSubscription


register = template.Library()


Expand Down
1 change: 0 additions & 1 deletion pinax/forums/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf.urls import include, url


urlpatterns = (
url(r"^", include("pinax.forums.urls", namespace="pinax_forums")),
)
Loading

0 comments on commit 9c1455e

Please sign in to comment.