Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Commit

Permalink
Merge pull request #12 from bradmontgomery/docs
Browse files Browse the repository at this point in the history
Added instructions to run the test suite
  • Loading branch information
ecometricabot committed Apr 14, 2014
2 parents be54fa2 + 413ab70 commit 74a6ff9
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Requirements
* PostgreSQL
* psycopg2
* Django >= 1.2

The ARRAY db type is PostgreSQL specific, so these model fields currently
work only on PostgreSQL with psycopg2. A ``FieldError`` will be raised if the
field is used with another database.
Expand Down Expand Up @@ -42,15 +42,15 @@ Custom Fields
To define a new array field for a base field type ``FooField``::

import dbarray

class FooArrayField(dbarray.ArrayFieldBase, FooField):
__metaclass__ = dbarray.ArrayFieldMetaclass

This may or may not work depending on a few factors. You might, for example, need
to override the db_type method to make it put the ``[]`` in the right spot in the column
type used in generated SQL.

Another issue that may arise when performing lookups with array fields
Another issue that may arise when performing lookups with array fields
is that PostgreSQL may get the query parameter as a data type
that isn't compatible with the type of the db column (for example text[]
instead of varchar[]). Then you will get an error like the following::
Expand All @@ -67,6 +67,22 @@ to the SQL query.
Look in the source code for more examples of how to handle issues with new
ArrayField types.

Running the tests
=================

Versions of Django prior to 1.6 require
`django-discover-runner <https://pypi.python.org/pypi/django-discover-runner>`_.
Install it with::

pip install -U django-discover-runner

The default tests also require a Postgres database named ``dbarray`` running on
localhost. See the test configuration in dbarray/tests/run.py.

You can run the test suite with::

python dbarray/tests/run.py


Version History
===============
Expand Down

0 comments on commit 74a6ff9

Please sign in to comment.