Skip to content

Commit 5a3eb52

Browse files
committed
Add test and travis configuration
Add travis, codecov and test configuration No refs
1 parent 04aa9af commit 5a3eb52

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ pip-log.txt
3434
sdist/
3535
target/
3636
var/
37+
venv/

.travis.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sudo: false
2+
language: python
3+
cache: pip
4+
python:
5+
- "3.4"
6+
- "2.7"
7+
install:
8+
- pip install -U pip
9+
- pip install -r requirements-test.txt
10+
script:
11+
- py.test -ra -vvv --cov
12+
after_success:
13+
- bash <(curl -s https://codecov.io/bash)

README.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Django Sorting Field
22
====================
3+
.. image:: https://travis-ci.org/andersinno/django-sorting-field.svg?branch=master
4+
:target: https://travis-ci.org/andersinno/django-sorting-field
5+
.. image:: https://codecov.io/gh/andersinno/django-sorting-field/branch/master/graph/badge.svg
6+
:target: https://codecov.io/gh/andersinno/django-sorting-field
37

48
* This package implements a Django form field + widget for drag & drog sorting of items
59
* Sorting any item with a field called ``id`` is supported
@@ -77,9 +81,10 @@ Add the SortingFormField to the CMS Plugin and populate it
7781
7882
def __init__(self, *args, **kwargs):
7983
super(CarouselPluginForm, self).__init__(*args, **kwargs)
80-
self.fields["carousel_order"].populate(
81-
items=self.instance.carousel.pictures.all(),
82-
)
84+
if self.instance.pk:
85+
self.fields["carousel_order"].populate(
86+
items=self.instance.carousel.pictures.all(),
87+
)
8388
8489
class CMSCarouselPlugin(CMSPluginBase):
8590
model = CarouselPlugin

requirements-test.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-e .
2+
pytest
3+
pytest-cov

0 commit comments

Comments
 (0)