Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python
python:
- "3.3"
- "3.4"
- "3.5"
install:
- pip install -r requirements.txt --use-mirrors
- pip install coverage
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down Expand Up @@ -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']),
Expand Down
18 changes: 8 additions & 10 deletions pypo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}

Expand Down Expand Up @@ -82,7 +77,6 @@

BOWER = path.join(PROJECT_ROOT, 'bower_components')


# Additional locations of static files
STATICFILES_DIRS = (
BOWER,
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -212,8 +212,6 @@
'haystack',
'taggit',
'rest_framework',
'django_admin_bootstrapped.bootstrap3',
'django_admin_bootstrapped',
'django.contrib.admin',
'django.contrib.humanize',
'settings_context_processor',
Expand Down
2 changes: 1 addition & 1 deletion readme/api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 9 additions & 4 deletions readme/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
37 changes: 18 additions & 19 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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