mirror of
https://github.com/QingdaoU/Spirit.git
synced 2024-12-28 15:32:12 +00:00
Feature/django1 11 (#200)
* update requirements * update compatibility * update travis * update history
This commit is contained in:
parent
43a4d800bc
commit
bbe9969573
@ -7,10 +7,12 @@ python:
|
||||
- "2.7"
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
env:
|
||||
- DJANGO=1.8.16
|
||||
- DJANGO=1.9.11
|
||||
- DJANGO=1.10.3
|
||||
- DJANGO=1.8.18
|
||||
- DJANGO=1.9.13
|
||||
- DJANGO=1.10.8
|
||||
- DJANGO=1.11.5
|
||||
install:
|
||||
- pip install --upgrade pip
|
||||
- pip install -r requirements.txt
|
||||
|
@ -2,7 +2,8 @@
|
||||
==================
|
||||
|
||||
* Drops support for Python 3.3
|
||||
* Adds support for Django 1.9 and 1.10
|
||||
* Adds support for Python 3.6
|
||||
* Adds support for Django 1.9, 1.10 and 1.11
|
||||
* Adds python-magic dependency (to check uploaded files)
|
||||
* New: file upload on comments
|
||||
* Improvement: Adds `ST_UPLOAD_IMAGE_ENABLED`
|
||||
@ -11,6 +12,7 @@
|
||||
* Remove deprecated `topic_poll` app
|
||||
* Remove deprecated (since v0.2) `spirit_user.User` (PR #141),
|
||||
read the wiki or the PR for a workaround
|
||||
* Updates mistune, haystack and woosh dependencies
|
||||
* Deprecates `spirit.settings`. It will be removed in future releases
|
||||
|
||||
0.4.8
|
||||
|
@ -11,8 +11,8 @@ To see it in action, please visit [The Spirit Project](http://spirit-project.com
|
||||
|
||||
## Compatibility
|
||||
|
||||
* Python 2.7, 3.4 and 3.5 (recommended)
|
||||
* Django 1.8 LTS (recommended), 1.9 and 1.10
|
||||
* Python 2.7, 3.4, 3.5 and 3.6 (recommended)
|
||||
* Django 1.8 LTS, 1.9, 1.10 and 1.11 LTS (recommended)
|
||||
* PostgreSQL (recommended), MySQL, Oracle Database and SQLite
|
||||
|
||||
## Usage
|
||||
|
@ -6,8 +6,8 @@ Installation
|
||||
Compatibility
|
||||
-------------
|
||||
|
||||
* Python 2.7, 3.4 and 3.5 (recommended)
|
||||
* Django 1.8 LTS (recommended), 1.9 and 1.10
|
||||
* Python 2.7, 3.4, 3.5 and 3.6 (recommended)
|
||||
* Django 1.8 LTS, 1.9, 1.10 and 1.11 LTS (recommended)
|
||||
* PostgreSQL (recommended), MySQL, Oracle Database and SQLite
|
||||
|
||||
Get started
|
||||
|
@ -1,8 +1,8 @@
|
||||
Django>=1.8,<1.11
|
||||
django-haystack==2.5.1
|
||||
whoosh==2.7.0
|
||||
mistune==0.7.1
|
||||
Pillow==3.1.0
|
||||
Django>=1.8,<1.12
|
||||
django-haystack==2.6.1
|
||||
whoosh==2.7.4
|
||||
mistune==0.7.4
|
||||
Pillow==4.2.1
|
||||
django-infinite-scroll-pagination>=0.2.0,<0.3
|
||||
django-djconfig>=0.5.1,<0.6
|
||||
uni-slugify==0.1.4
|
||||
|
@ -1,49 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db.models.fields import SlugField
|
||||
from django.utils.text import slugify
|
||||
from django.utils.encoding import smart_text
|
||||
|
||||
__all__ = ['AutoSlugField', ]
|
||||
|
||||
|
||||
class AutoSlugField(SlugField):
|
||||
"""
|
||||
Auto populates itself from another field.
|
||||
|
||||
It behaves like a regular SlugField.
|
||||
When populate_from is provided it'll populate itself on creation,
|
||||
only if a slug was not provided.
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.populate_from = kwargs.pop('populate_from', None)
|
||||
super(AutoSlugField, self).__init__(*args, **kwargs)
|
||||
|
||||
def pre_save(self, instance, add):
|
||||
default = super(AutoSlugField, self).pre_save(instance, add)
|
||||
|
||||
if default or not add or not self.populate_from:
|
||||
return default
|
||||
|
||||
value = getattr(instance, self.populate_from)
|
||||
|
||||
if value is None:
|
||||
return default
|
||||
|
||||
slug = slugify(smart_text(value))[:self.max_length].strip('-')
|
||||
|
||||
# Update the model’s attribute
|
||||
setattr(instance, self.attname, slug)
|
||||
|
||||
return slug
|
||||
|
||||
def deconstruct(self):
|
||||
name, path, args, kwargs = super(AutoSlugField, self).deconstruct()
|
||||
|
||||
if self.populate_from is not None:
|
||||
kwargs['populate_from'] = self.populate_from
|
||||
|
||||
return name, path, args, kwargs
|
Loading…
Reference in New Issue
Block a user