Merge pull request #196 from nephila/feature/fix_parler
Feature/fix parler
This commit is contained in:
commit
d5449382c1
5 changed files with 18 additions and 10 deletions
|
@ -7,6 +7,7 @@ History
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
|
|
||||||
* Make categories non required
|
* Make categories non required
|
||||||
|
* Fix tests with parler>=1.6
|
||||||
|
|
||||||
0.6.3 (2015-12-22)
|
0.6.3 (2015-12-22)
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
|
|
|
@ -9,3 +9,4 @@ https://github.com/nephila/djangocms-helper/archive/develop.zip
|
||||||
tox>=2.0
|
tox>=2.0
|
||||||
wheel
|
wheel
|
||||||
pysolr
|
pysolr
|
||||||
|
django-parler>=1.6
|
||||||
|
|
|
@ -6,6 +6,7 @@ from copy import deepcopy
|
||||||
from cmsplugin_filer_image.models import ThumbnailOption
|
from cmsplugin_filer_image.models import ThumbnailOption
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
from django.core.cache import cache
|
||||||
from djangocms_helper.base_test import BaseTestCase
|
from djangocms_helper.base_test import BaseTestCase
|
||||||
from haystack import connections
|
from haystack import connections
|
||||||
from haystack.constants import DEFAULT_ALIAS
|
from haystack.constants import DEFAULT_ALIAS
|
||||||
|
@ -18,7 +19,7 @@ User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
def _get_cat_pk(lang, name):
|
def _get_cat_pk(lang, name):
|
||||||
return lambda: BlogCategory.objects.translated(lang, name=name).get().pk
|
return lambda: BlogCategory.objects.language(lang).translated(lang, name=name).get().pk
|
||||||
|
|
||||||
|
|
||||||
class BaseTest(BaseTestCase):
|
class BaseTest(BaseTestCase):
|
||||||
|
@ -65,7 +66,8 @@ class BaseTest(BaseTestCase):
|
||||||
'description': 'Descrizione del terzo post', 'keywords': 'keyword5, keyword6',
|
'description': 'Descrizione del terzo post', 'keywords': 'keyword5, keyword6',
|
||||||
'text': 'Testo del terzo post'},
|
'text': 'Testo del terzo post'},
|
||||||
},
|
},
|
||||||
{'en': {'title': 'Different appconfig', 'abstract': '<p>Different appconfig first line</p>',
|
{'en': {'title': 'Different appconfig',
|
||||||
|
'abstract': '<p>Different appconfig first line</p>',
|
||||||
'description': 'Different appconfig description', 'keywords': 'keyword5, keyword6',
|
'description': 'Different appconfig description', 'keywords': 'keyword5, keyword6',
|
||||||
'text': 'Different appconfig text', 'app_config': 'sample_app2', 'publish': True},
|
'text': 'Different appconfig text', 'app_config': 'sample_app2', 'publish': True},
|
||||||
'it': {'title': 'Altro appconfig', 'abstract': '<p>prima riga del Altro appconfig</p>',
|
'it': {'title': 'Altro appconfig', 'abstract': '<p>prima riga del Altro appconfig</p>',
|
||||||
|
@ -84,17 +86,19 @@ class BaseTest(BaseTestCase):
|
||||||
{'en': {'name': 'Almost', 'app_config': 'sample_app'},
|
{'en': {'name': 'Almost', 'app_config': 'sample_app'},
|
||||||
'it': {'name': 'Mezzo'},
|
'it': {'name': 'Mezzo'},
|
||||||
},
|
},
|
||||||
{'en': {'name': 'Loud', 'parent_id': _get_cat_pk('en', 'Almost'), 'app_config': 'sample_app'},
|
|
||||||
'it': {'name': 'Forte', 'parent_id': _get_cat_pk('it', 'Mezzo')},
|
|
||||||
},
|
|
||||||
{'en': {'name': 'Silent', 'parent_id': _get_cat_pk('en', 'Almost'), 'app_config': 'sample_app'},
|
|
||||||
},
|
|
||||||
{'en': {'name': 'Drums', 'app_config': 'sample_app2'},
|
{'en': {'name': 'Drums', 'app_config': 'sample_app2'},
|
||||||
'it': {'name': 'Tamburi'},
|
'it': {'name': 'Tamburi'},
|
||||||
},
|
},
|
||||||
{'en': {'name': 'Guitars', 'app_config': 'sample_app2'},
|
{'en': {'name': 'Guitars', 'app_config': 'sample_app2'},
|
||||||
'it': {'name': 'Chitarre'},
|
'it': {'name': 'Chitarre'},
|
||||||
},
|
},
|
||||||
|
{'en': {'name': 'Loud', 'parent_id': _get_cat_pk('en', 'Almost'),
|
||||||
|
'app_config': 'sample_app'},
|
||||||
|
'it': {'name': 'Forte', 'parent_id': _get_cat_pk('it', 'Mezzo')},
|
||||||
|
},
|
||||||
|
{'en': {'name': 'Silent', 'parent_id': _get_cat_pk('en', 'Almost'),
|
||||||
|
'app_config': 'sample_app'},
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -120,11 +124,13 @@ class BaseTest(BaseTestCase):
|
||||||
'sample_app': cls.app_config_1,
|
'sample_app': cls.app_config_1,
|
||||||
'sample_app2': cls.app_config_2,
|
'sample_app2': cls.app_config_2,
|
||||||
}
|
}
|
||||||
cls.category_1 = BlogCategory.objects.create(name='category 1', app_config=cls.app_config_1)
|
cls.category_1 = BlogCategory.objects.create(name='category 1',
|
||||||
|
app_config=cls.app_config_1)
|
||||||
cls.category_1.set_current_language('it', initialize=True)
|
cls.category_1.set_current_language('it', initialize=True)
|
||||||
cls.category_1.name = 'categoria 1'
|
cls.category_1.name = 'categoria 1'
|
||||||
cls.category_1.save()
|
cls.category_1.save()
|
||||||
cls.site_2 = Site.objects.create(domain='http://example2.com', name='example 2')
|
cls.site_2 = Site.objects.create(domain='http://example2.com', name='example 2')
|
||||||
|
cache.clear()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -168,7 +174,6 @@ class BaseTest(BaseTestCase):
|
||||||
meta_description=data['description'],
|
meta_description=data['description'],
|
||||||
meta_keywords=data['keywords']
|
meta_keywords=data['keywords']
|
||||||
)
|
)
|
||||||
post = self.reload_model(post)
|
|
||||||
post.categories.add(self.category_1)
|
post.categories.add(self.category_1)
|
||||||
if sites:
|
if sites:
|
||||||
for site in sites:
|
for site in sites:
|
||||||
|
@ -177,6 +182,7 @@ class BaseTest(BaseTestCase):
|
||||||
|
|
||||||
def get_posts(self, sites=None):
|
def get_posts(self, sites=None):
|
||||||
posts = []
|
posts = []
|
||||||
|
cache.clear()
|
||||||
for post in self._post_data:
|
for post in self._post_data:
|
||||||
post1 = self._get_post(post['en'], sites=sites)
|
post1 = self._get_post(post['en'], sites=sites)
|
||||||
post1 = self._get_post(post['it'], post=post1, lang='it')
|
post1 = self._get_post(post['it'], post=post1, lang='it')
|
||||||
|
|
|
@ -21,6 +21,7 @@ class MenuTest(BaseTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MenuTest, self).setUp()
|
super(MenuTest, self).setUp()
|
||||||
self.cats = [self.category_1]
|
self.cats = [self.category_1]
|
||||||
|
cache.clear()
|
||||||
for i, lang_data in enumerate(self._categories_data):
|
for i, lang_data in enumerate(self._categories_data):
|
||||||
cat = self._get_category(lang_data['en'])
|
cat = self._get_category(lang_data['en'])
|
||||||
if 'it' in lang_data:
|
if 'it' in lang_data:
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -18,7 +18,6 @@ deps =
|
||||||
https://github.com/nephila/django-meta-mixin/archive/master.zip
|
https://github.com/nephila/django-meta-mixin/archive/master.zip
|
||||||
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
||||||
py26: unittest2
|
py26: unittest2
|
||||||
django-parler<1.5
|
|
||||||
django-mptt<0.8
|
django-mptt<0.8
|
||||||
https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip
|
https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip
|
||||||
https://github.com/nephila/djangocms-apphook-setup/archive/master.zip
|
https://github.com/nephila/djangocms-apphook-setup/archive/master.zip
|
||||||
|
|
Loading…
Reference in a new issue