diff --git a/.travis.yml b/.travis.yml index e9ffbe4..a5a6d47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: - - "3.3" - "3.4" + - "3.5" install: - pip install -r requirements.txt --use-mirrors - pip install coverage @@ -13,7 +13,6 @@ env: # - TEST_SUITE=python WEBDRIVER=PhantomJS script: ./run_tests.sh $TEST_SUITE before_script: - - psql -c 'create database pypo;' -U postgres - npm install -g bower - bower install -f - python manage.py migrate diff --git a/conftest.py b/conftest.py index 844fb5d..e04613f 100644 --- a/conftest.py +++ b/conftest.py @@ -74,7 +74,7 @@ def add_example_item(user, tags=None): item.save() return item -@pytest.yield_fixture(scope='module') +@pytest.yield_fixture def tagged_items(db, user): items = [ add_example_item(user, ('fish', 'boxing')), @@ -119,7 +119,7 @@ def test_index(settings): call_command('clear_index', interactive=False, verbosity=0) haystack.connections.reload('default') -@pytest.yield_fixture(scope='module') +@pytest.yield_fixture def simple_items(db, user): items = { 'item_fish': add_example_item(user, [QUEEN, 'fish', 'cookie']), diff --git a/pypo/settings.py b/pypo/settings.py index 58adb7d..c74d41f 100644 --- a/pypo/settings.py +++ b/pypo/settings.py @@ -17,13 +17,8 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'pypo', # Or path to database file if using sqlite3. - # The following settings are not used with sqlite3: - 'USER': 'postgres', - 'PASSWORD': '', - 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. - 'PORT': '', # Set to empty string for default. + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': path.join(PROJECT_ROOT, 'pypo.db'), # Or path to database file if using sqlite3. } } @@ -82,7 +77,6 @@ BOWER = path.join(PROJECT_ROOT, 'bower_components') - # Additional locations of static files STATICFILES_DIRS = ( BOWER, @@ -135,6 +129,12 @@ }, } +PIPELINE = { + 'JAVASCRIPT': PIPELINE_JS, + 'STYLESHEETS': PIPELINE_CSS, +} + + # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( @@ -212,8 +212,6 @@ 'haystack', 'taggit', 'rest_framework', - 'django_admin_bootstrapped.bootstrap3', - 'django_admin_bootstrapped', 'django.contrib.admin', 'django.contrib.humanize', 'settings_context_processor', diff --git a/readme/api_urls.py b/readme/api_urls.py index 4ef8cae..929e2d5 100644 --- a/readme/api_urls.py +++ b/readme/api_urls.py @@ -3,6 +3,6 @@ from readme.api import ItemViewSet router = routers.DefaultRouter() -router.register(r'items', ItemViewSet) +router.register(r'items', ItemViewSet, base_name='items') urlpatterns = router.urls diff --git a/readme/models.py b/readme/models.py index e104736..ffd9e98 100644 --- a/readme/models.py +++ b/readme/models.py @@ -53,14 +53,19 @@ class TaggedItem(ItemBase): content_object = models.ForeignKey('Item') @classmethod - def tags_for(cls, model, instance=None): + def tags_for(cls, model, instance=None, **extra_filters): + kwargs = extra_filters or {} if instance is not None: - return cls.tag_model().objects.filter(**{ + kwargs.update({ '%s__content_object' % cls.tag_relname(): instance }) - return cls.tag_model().objects.filter(**{ + return cls.tag_model().objects.filter(**kwargs) + kwargs.update({ '%s__content_object__isnull' % cls.tag_relname(): False - }).distinct() + }) + return cls.tag_model().objects.filter(**kwargs).distinct() + + class Item(models.Model): """ diff --git a/requirements.txt b/requirements.txt index e6d3ead..4d4a152 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,22 @@ -Django==1.7.3 -Whoosh>=2.6 -django-crispy-forms==1.4 -django-filter==0.9.1 -django-taggit==0.12.2 -djangorestframework==3.0.0 -psycopg2==2.5.4 +Django==1.8.12 +Whoosh>=2.7.4 +django-crispy-forms==1.6 +django-filter==0.13 +django-taggit==0.18.1 +djangorestframework==3.3.3 +psycopg2==2.6.1 pycrypto==2.6.1 -lxml==3.4.1 -requests==2.5.0 -tld==0.7.2 -selenium==2.44.0 +lxml==3.6.0 +requests==2.9.1 +tld==0.7.6 +selenium==2.53.1 cssselect==0.9.1 -pytest==2.6.4 -pytest-django==2.7.0 -pytest-cov==1.8.1 -django-pipeline==1.4.2 +pytest==2.9.1 +pytest-django==2.9.1 +pytest-cov==2.2.1 +django-pipeline==1.6.8 django-settings-context-processor==0.2 -django-admin-bootstrapped==2.3.1 -django-sitegate==0.9 -bleach==1.4 +django-sitegate==0.10.3 +bleach==1.4.2 -e git+https://github.com/audax/python-readability.git@master#egg=python-readability --e git+https://github.com/audax/django-haystack.git@whoosh-basic-facets#egg=django-haystack +django-haystack==2.4