Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit 10ab20f

Browse files
Merge branch 'feature/drop_python2' into develop to include changes made to drop Python2 support.
2 parents be8d173 + 100ac97 commit 10ab20f

13 files changed

+39
-39
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
language: python
22
python:
3-
- "2.7"
43
- "3.5"
54
- "3.6"
65

76
env:
87
matrix:
9-
- DJANGO="Django>=1.11,<1.12
8+
- DJANGO="Django>=2.0,<2.1"
109

1110
branches:
1211
only:

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ The development of this package is kindly supported by SWAPPS_ and constantly de
3030

3131
Please take in considerations than this application is still under active development and we cannot guarantee that nothing will break between versions. Most of the core features are already there, so we expect to release a beta version soon.
3232

33+
Version compatibility
34+
=====================
35+
36+
Starting with version 0.10.12, django-qa requires Django 2.0 or later and is only compatible with Python 3.5 or later.
37+
38+
============== ===================
39+
Django version django-qa
40+
============== ===================
41+
2.0 or later 0.10.12
42+
1.11.x 0.10.11
43+
============== ===================
44+
45+
3346
Features
3447
========
3548
* Assumes nothing about the rest of your application.

docs/installation.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,3 @@ Run migrations::
3737
Once all the previous steps have been solved, check the settings topic to include those into your project settings file.
3838

3939
And that's it!
40-
41-
CAVEATS
42-
-------
43-
There is an issue with django-markdown-app versioning. It does not support django1.11(LTS) and 2 simultaneously.
44-
If you have a project using django>=2.0, you will need to specify the django-markdown-app manually to the latest.

manage.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
import os
32
from django.core import management
43

qa/models.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
from django.conf import settings
33
from django.db import models
44
from django.db.models import F
5-
from django.utils.encoding import python_2_unicode_compatible
65
from django.utils.text import slugify
76
from django_markdown.models import MarkdownField
87
from hitcount.models import HitCountMixin
98
from taggit.managers import TaggableManager
109

1110

12-
@python_2_unicode_compatible
1311
class UserQAProfile(models.Model):
1412
"""Model class to define a User profile for the app, directly linked
1513
to the core Django user model."""
@@ -28,7 +26,6 @@ def __str__(self): # pragma: no cover
2826
return self.user.username
2927

3028

31-
@python_2_unicode_compatible
3229
class Question(models.Model, HitCountMixin):
3330
"""Model class to contain every question in the forum"""
3431
slug = models.SlugField(max_length=200)
@@ -43,6 +40,9 @@ class Question(models.Model, HitCountMixin):
4340
negative_votes = models.IntegerField(default=0)
4441
total_points = models.IntegerField(default=0)
4542

43+
class Meta:
44+
ordering = ['-pub_date']
45+
4646
def save(self, *args, **kwargs):
4747
if not self.id:
4848
self.slug = slugify(self.title)
@@ -61,7 +61,6 @@ def __str__(self):
6161
return self.title
6262

6363

64-
@python_2_unicode_compatible
6564
class Answer(models.Model):
6665
"""Model class to contain every answer in the forum and to link it
6766
to the proper question."""
@@ -118,7 +117,6 @@ class Meta:
118117
unique_together = (('user', 'question'),)
119118

120119

121-
@python_2_unicode_compatible
122120
class BaseComment(models.Model):
123121
"""Abstract model to define the basic elements to every single comment."""
124122
pub_date = models.DateTimeField('date published', auto_now_add=True)

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
django-annoying==0.10.4
2-
django-markdown-app==0.9.3.1
3-
django-taggit==0.22.2
4-
pytz==2018.5
5-
django-hitcount==1.3.0
1+
django-annoying>=0.10.4
2+
django-markdown-app>=0.9.4.1
3+
django-taggit>=0.22.2
4+
pytz>=2018.5
5+
django-hitcount>=1.3.0

runtests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8
31
from __future__ import unicode_literals, absolute_import
42

53
import os

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
31
from setuptools import find_packages, setup
42

53
def get_long_description():

test_project/manage.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
import os
32
import sys
43

test_project/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
-e ../
66

77
# This project requirements
8-
django-bootstrap3==9.1.0
8+
django-bootstrap3==10.0.1

test_project/simpleqa/settings.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@
4545
# 'rest_framework',
4646
)
4747

48-
MIDDLEWARE = (
48+
MIDDLEWARE = [
4949
'django.contrib.sessions.middleware.SessionMiddleware',
50-
'django.middleware.common.CommonMiddleware',
51-
'django.middleware.csrf.CsrfViewMiddleware',
5250
'django.contrib.auth.middleware.AuthenticationMiddleware',
5351
'django.contrib.messages.middleware.MessageMiddleware',
5452
'django.middleware.clickjacking.XFrameOptionsMiddleware',
55-
)
53+
'django.middleware.common.CommonMiddleware',
54+
'django.middleware.csrf.CsrfViewMiddleware',
55+
'django.middleware.locale.LocaleMiddleware',
56+
]
5657

5758
ROOT_URLCONF = 'simpleqa.urls'
5859

tests/settings.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8
21
from __future__ import unicode_literals, absolute_import
32

43
import django
@@ -25,15 +24,16 @@
2524

2625
SECRET_KEY = 'l#^#iad$8$4=dlh74$!xs=3g4jb(&j+y6*ozy&8k1-&d+vruzy'
2726

28-
MIDDLEWARE_CLASSES = (
29-
'django.contrib.sessions.middleware.SessionMiddleware',
30-
'django.middleware.common.CommonMiddleware',
31-
'django.middleware.csrf.CsrfViewMiddleware',
32-
'django.contrib.auth.middleware.AuthenticationMiddleware',
33-
'django.contrib.messages.middleware.MessageMiddleware',
34-
'django.middleware.clickjacking.XFrameOptionsMiddleware',
35-
'django.middleware.locale.LocaleMiddleware',
36-
)
27+
MIDDLEWARE = [
28+
'django.contrib.sessions.middleware.SessionMiddleware',
29+
'django.contrib.auth.middleware.AuthenticationMiddleware',
30+
'django.contrib.messages.middleware.MessageMiddleware',
31+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
32+
'django.middleware.common.CommonMiddleware',
33+
'django.middleware.csrf.CsrfViewMiddleware',
34+
'django.middleware.locale.LocaleMiddleware',
35+
]
36+
3737

3838
ROOT_URLCONF = 'qa.urls'
3939

tests/test_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.contrib.auth import get_user_model
22
from django.core.exceptions import ValidationError
3-
from django.core.urlresolvers import reverse
3+
from django.urls import reverse
44
from django.test import Client, TestCase, override_settings
55
from qa.mixins import LoginRequired
66
from qa.models import (Answer, AnswerVote, Question, QuestionComment,

0 commit comments

Comments
 (0)