Django 1.5 support fixes
This commit is contained in:
parent
2b9836c1cb
commit
fca827025c
3 changed files with 10 additions and 4 deletions
|
@ -74,6 +74,12 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager):
|
|||
end_date_field = "date_published_end"
|
||||
publish_field = "publish"
|
||||
|
||||
def get_queryset(self, *args, **kwargs):
|
||||
try:
|
||||
return super(GenericDateTaggedManager, self).get_queryset(*args, **kwargs)
|
||||
except AttributeError:
|
||||
return super(GenericDateTaggedManager, self).get_query_set(*args, **kwargs)
|
||||
|
||||
def published(self, queryset=None):
|
||||
queryset = self.published_future(queryset)
|
||||
if self.start_date_field:
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.db import models
|
|||
from django.utils import timezone
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import ugettext_lazy as _, get_language
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from djangocms_text_ckeditor.fields import HTMLField
|
||||
from filer.fields.image import FilerImageField
|
||||
from parler.models import TranslatableModel, TranslatedFields
|
||||
|
|
|
@ -35,7 +35,7 @@ class ViewTest(BaseTest):
|
|||
view_obj.kwargs = {}
|
||||
view_obj.object_list = view_obj.get_queryset()
|
||||
view_obj.paginate_by = 1
|
||||
context = view_obj.get_context_data()
|
||||
context = view_obj.get_context_data(object_list=view_obj.object_list)
|
||||
self.assertTrue(context['is_paginated'])
|
||||
self.assertEqual(list(context['post_list']), [post_2])
|
||||
self.assertEqual(context['paginator'].count, 2)
|
||||
|
@ -47,7 +47,7 @@ class ViewTest(BaseTest):
|
|||
activate('it')
|
||||
view_obj.request = request
|
||||
view_obj.object_list = view_obj.get_queryset()
|
||||
context = view_obj.get_context_data()
|
||||
context = view_obj.get_context_data(object_list=view_obj.object_list)
|
||||
self.assertEqual(context['post_list'][0].title, 'Secondo post')
|
||||
response = view_obj.render_to_response(context)
|
||||
self.assertContains(response, context['post_list'][0].get_absolute_url())
|
||||
|
@ -113,5 +113,5 @@ class ViewTest(BaseTest):
|
|||
self.assertEqual(list(qs), [post_1])
|
||||
|
||||
view_obj.object_list = qs
|
||||
context = view_obj.get_context_data()
|
||||
context = view_obj.get_context_data(object_list=view_obj.object_list)
|
||||
self.assertEqual(context['archive_date'], date(year=date.today().year, month=date.today().month, day=1))
|
Loading…
Reference in a new issue