Permalink
Browse files

Merge branch 'feature/hvad' into feature/django-1.4-admin

  • Loading branch information...
2 parents b53dc71 + 4e4502f commit 28718479d2ee11e0dc51fa49dc1be9f5b1c377bc @ojii ojii committed May 4, 2012
Showing with 30 additions and 17 deletions.
  1. +4 −4 .travis.yml
  2. +8 −0 docs/index.rst
  3. +4 −3 docs/public/installation.rst
  4. +3 −3 hvad/admin.py
  5. +4 −3 hvad/tests/forms.py
  6. +4 −1 hvad/views.py
  7. +1 −1 nani/admin.py
  8. +1 −1 nani/views.py
  9. +1 −1 setup.py
View
@@ -3,10 +3,10 @@ python:
- 2.6
- 2.7
env:
- - DJANGO_VERSION=1.2.7
- - DJANGO_VERSION=1.3.1
- - DJANGO_VERSION=1.4
+ - DJANGO_VERSION=1.2.7 ADDITIONAL_PACKAGES='sphinx django-cbv'
+ - DJANGO_VERSION=1.3.1 ADDITIONAL_PACKAGES='sphinx'
+ - DJANGO_VERSION=1.4 ADDITIONAL_PACKAGES='sphinx'
install:
- - pip install -q Django==$DJANGO_VERSION && pip install sphinx
+ - pip install -q Django==$DJANGO_VERSION && pip install $ADDITIONAL_PACKAGES
- python setup.py -q install
script: ./runtests.sh
View
@@ -27,6 +27,14 @@ While django-hvad tries to be as simple to use as possible, it's still
recommended that you only use it if you consider yourself to be very strong in
Python and Django.
+
+************************
+Notes on django versions
+************************
+
+django-hvad is tested on python 2.6 and 2.7 with django 1.2.7, 1.3.1 and 1.4. These should all work as expected, but for django 1.2.x you need you need to install django-cbv to use the class based views.
+
+
***************
Contents
***************
@@ -10,16 +10,17 @@ Requirements
* `Django`_ 1.2 or higher
* Python 2.5 or a higher release of Python 2.x or PyPy 1.5, Python 3.x is not
supported (yet).
-
+* For Django 1.2.x you need `django-cbv`_
************
Installation
************
-Install django-nani using `pip`_ by running ``pip install django-nani``. Then
+Install django-hvad using `pip`_ by running ``pip install django-hvad``. Then
add ``'nani'`` to your ``INSTALLED_APPS`` to make the admin templates work.
.. _pip: http://pypi.python.org/pypi/pip
-.. _Django: http://www.djangoproject.com
+.. _Django: http://www.djangoproject.com
+.. _django-cbv: http://pypi.python.org/pypi/django-cbv
View
@@ -329,7 +329,7 @@ def queryset(self, request):
languages.append(lang)
qs = self.model._default_manager.untranslated().use_fallbacks(*languages)
# TODO: this should be handled by some parameter to the ChangeList.
- ordering = self.ordering or () # otherwise we might try to *None, which is bad ;)
+ ordering = getattr(self, 'ordering', None) or () # otherwise we might try to *None, which is bad ;)
if ordering:
qs = qs.order_by(*ordering)
return qs
@@ -550,7 +550,7 @@ def queryset(self, request):
language = self._language(request)
qs = self.model._default_manager.all()#.language(language)
# TODO: this should be handled by some parameter to the ChangeList.
- ordering = self.ordering or () # otherwise we might try to *None, which is bad ;)
+ ordering = getattr(self, 'ordering', None) or () # otherwise we might try to *None, which is bad ;)
if ordering:
qs = qs.order_by(*ordering)
return qs
@@ -560,4 +560,4 @@ class TranslatableStackedInline(TranslatableInlineModelAdmin):
template = 'admin/hvad/edit_inline/stacked.html'
class TranslatableTabularInline(TranslatableInlineModelAdmin):
- template = 'admin/hvad/edit_inline/tabular.html'
+ template = 'admin/hvad/edit_inline/tabular.html'
View
@@ -129,11 +129,12 @@ def test_no_language_code_in_fields(self):
self.assertFalse(form.fields.has_key("language_code"))
def test_form_wrong_field_in_class(self):
- with LanguageOverride("en"):
- with self.assertRaises(FieldError):
+ with LanguageOverride("en"):
+ def create_wrong_form():
class WrongForm(TranslatableModelForm):
class Meta:
model = Normal
fields = ['a_field_that_doesnt_exist']
- form = WrongForm()
+ form = WrongForm()
+ self.assertRaises(FieldError, create_wrong_form)
View
@@ -1,5 +1,8 @@
from django.http import Http404
-from django.views.generic.edit import UpdateView
+try:
+ from django.views.generic.edit import UpdateView
+except ImportError:
+ from cbv.views.edit import UpdateView
from admin import TranslatableModelAdminMixin
from forms import translatable_modelform_factory, TranslatableModelForm
from utils import collect_context_modifiers
View
@@ -1,4 +1,4 @@
from hvad.admin import *
import warnings
-warnings.warn("The 'nani' namespace is deprecated, please change your imports to use 'hvad' instead", DeprecationWarning)
+warnings.warn("The 'nani' namespace is deprecated, please change your imports to use 'hvad' instead", DeprecationWarning)
View
@@ -1,4 +1,4 @@
from hvad.views import *
import warnings
-warnings.warn("The 'nani' namespace is deprecated, please change your imports to use 'hvad' instead", DeprecationWarning)
+warnings.warn("The 'nani' namespace is deprecated, please change your imports to use 'hvad' instead", DeprecationWarning)
View
@@ -1,5 +1,5 @@
from setuptools import setup, find_packages
-from nani import __version__ as version
+from hvad import __version__ as version
setup(
name = 'django-hvad',

0 comments on commit 2871847

Please sign in to comment.