I want to do this import in my django models.py:
from django.contrib.postgres.fields import ArrayField
I read this documentation https://docs.djangoproject.com/en/dev/ref/contrib/ and I added 'django.contrib.postgres' into my INSTALLED_APPS in settings.py, but when I try to sync my db or to runserver I got "ImportError: No module named postgres"
Is there something else I should do or install? django.contrib.postgres is part of the core distribution right?
This is traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "c:\Python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_com
utility.execute()
File "c:\Python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\Python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "c:\Python27\lib\site-packages\django\core\management\base.py", line 280, in execute
translation.activate('en-us')
File "c:\Python27\lib\site-packages\django\utils\translation\__init__.py", line 130, in activate
return _trans.activate(language)
File "c:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 188, in activate
_active.value = translation(language)
File "c:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "c:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 159, in _fetch
app = import_module(appname)
File "c:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named postgres
django.contrib.postgres
will be a part of1.8
release.Fortunately there are several unofficial implementations postgresql arrays in django. One of the most notable being djorm-pgarray. Another option is django-dbarray when Django 1.8 eventually gets rolled out, migration shouldn't be too difficult.