-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andreu Vallbona
committed
Jul 26, 2016
1 parent
b6ebd57
commit f2c0962
Showing
14 changed files
with
180 additions
and
16 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
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
|
||
import os | ||
import re | ||
import codecs | ||
from setuptools import find_packages, setup | ||
|
||
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: | ||
|
@@ -7,17 +10,41 @@ | |
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
|
||
def get_version(package): | ||
""" | ||
Return package version as listed in `__version__` in `init.py`. | ||
""" | ||
init_py = codecs.open(os.path.join(package, '__init__.py'), encoding='utf-8').read() | ||
return re.search("^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1) | ||
|
||
|
||
def get_author(package): | ||
""" | ||
Return package author as listed in `__author__` in `init.py`. | ||
""" | ||
init_py = codecs.open(os.path.join(package, '__init__.py'), encoding='utf-8').read() | ||
return re.search("^__author__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1) | ||
|
||
|
||
def get_email(package): | ||
""" | ||
Return package email as listed in `__email__` in `init.py`. | ||
""" | ||
init_py = codecs.open(os.path.join(package, '__init__.py'), encoding='utf-8').read() | ||
return re.search("^__email__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1) | ||
|
||
setup( | ||
name='transmanager', | ||
version='0.2.4', | ||
version=get_version('transmanager'), | ||
packages=find_packages(), | ||
include_package_data=True, | ||
license='BSD License', | ||
description='A simple Django app to deal with the model content translation tasks', | ||
long_description=README, | ||
url='https://github.com/APSL/transmanager', | ||
author='Andreu Vallbona', | ||
author_email='[email protected]', | ||
author=get_author('transmanager'), | ||
author_email=get_email('transmanager'), | ||
install_requires=[ | ||
'django', | ||
'django-filter', | ||
|
@@ -28,6 +55,8 @@ | |
'djangorestframework', | ||
'django-yubin', | ||
'django-tables2', | ||
'django-haystack', | ||
'whoosh' | ||
], | ||
classifiers=[ | ||
'Environment :: Web Environment', | ||
|
@@ -44,4 +73,4 @@ | |
'Framework :: Django :: 1.8', | ||
'Framework :: Django :: 1.9', | ||
], | ||
) | ||
) |
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 |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
__author__ = 'Andreu Vallbona' | ||
__email__ = '[email protected]' | ||
__version__ = '0.2.4' | ||
__version__ = '0.2.5' | ||
|
||
default_app_config = 'transmanager.apps.TransManagerConfig' |
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,21 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
import datetime | ||
from haystack import indexes | ||
from .models import TransTask | ||
|
||
|
||
class TransTaskIndex(indexes.SearchIndex, indexes.Indexable): | ||
text = indexes.CharField(document=True, use_template=True) | ||
object_field_value_translation = indexes.CharField(model_attr='object_field_value_translation', null=True) | ||
language = indexes.CharField(model_attr='language') | ||
user = indexes.CharField(model_attr='user') | ||
|
||
def get_model(self): | ||
return TransTask | ||
|
||
def index_queryset(self, using=None): | ||
""" | ||
Used when the entire index for model is updated. | ||
""" | ||
return self.get_model().objects.filter(date_creation__lte=datetime.datetime.now()) |
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
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
4 changes: 4 additions & 0 deletions
4
transmanager/templates/search/indexes/transmanager/transtask_text.txt
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,4 @@ | ||
{{ object.object_field_value }} | ||
{{ object.object_field_value_translation }} | ||
{{ object.user }} | ||
{{ object.language.code }} |
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