Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Fix for Django 1.7 #11

Merged
merged 17 commits into from
Nov 18, 2014
Merged

Fix for Django 1.7 #11

merged 17 commits into from
Nov 18, 2014

Conversation

henriquebastos
Copy link
Owner

@trbs, @end0, @owais, @kawa-marcin,

I've applied the suggested patches to fix the call to promote_joins in Django 1.7.

I've also updated travis and tox scripts to include Django's new version.

However due to Django's new AppConfig boot sequence, the tests are not running on Django 1.7.

py34-django1.7-postgres runtests: commands[1] | python runtests.py --settings tests.test_postgres
Creating test database for alias 'default'...
Traceback (most recent call last):
  File "runtests.py", line 44, in <module>
    runtests()
  File "runtests.py", line 40, in runtests
    sys.exit(runner.run_tests([]))
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/test/runner.py", line 147, in run_tests
    old_config = self.setup_databases()
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/test/runner.py", line 109, in setup_databases
    return setup_databases(self.verbosity, self.interactive, **kwargs)
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/test/runner.py", line 299, in setup_databases
    serialize=connection.settings_dict.get("TEST_SERIALIZE", True),
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/db/backends/creation.py", line 374, in create_test_db
    test_flush=True,
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/core/management/__init__.py", line 93, in call_command
    app_name = get_commands()[name]
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/functools.py", line 428, in wrapper
    result = user_function(*args, **kwds)
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/core/management/__init__.py", line 73, in get_commands
    for app_config in reversed(list(apps.get_app_configs())):
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/apps/registry.py", line 137, in get_app_configs
    self.check_apps_ready()
  File "/Users/henrique/workspace/django-aggregate-if/.tox/py34-django1.7-postgres/lib/python3.4/site-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

I need to make all tests passing before releasing 0.5. I plan to figure this out during the next week. Any help is very welcome.

@kakulukia
Copy link

+1 to plz fix this

@trbs
Copy link

trbs commented Sep 22, 2014

https://gist.github.com/trbs/3a0d2a1756c456d5d523

Fixes:

  • setting up application registry for Django-1.7
  • changed import of Approximate
  • one unit test

There is still one unit test failing:

......................E...
======================================================================
ERROR: test_relabel_aliases (tests.aggregation.tests.BaseAggregateTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/django-aggregate-if/tests/aggregation/tests.py", line 163, in test_relabel_aliases
    b = books.get(pk=1)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 351, in get
    num = len(clone)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 122, in __len__
    self._fetch_all()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 966, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 265, in iterator
    for row in compiler.results_iter():
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 700, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
    return Database.Cursor.execute(self, query, params)
OperationalError: no such column: aggregation_author.id

----------------------------------------------------------------------
Ran 26 tests in 1.513s

FAILED (errors=1)
Destroying test database for alias 'default'...

@asteinlein
Copy link

Any progress on this? Just came across this library which we would love to use, but we're on Django 1.7...

@trbs
Copy link

trbs commented Oct 21, 2014

You can always install my django17 branch directly from github:
https://github.com/trbs/django-aggregate-if/tree/django17

This is what I use for Django17

@kakulukia
Copy link

Nice to know!

@trbs
Copy link

trbs commented Oct 21, 2014

Forgot that @henriquebastos committed it to git here as well...
So instead of my branch people could use the github version (or specific commit) as well.

@henriquebastos
Copy link
Owner Author

The branch django-1.7 is well evolved. There's 1 failing test blocking the new release.

I didn't had the time to investigate it any further. Any help is very welcome.

If you're on a hurry you can:

pip install git+https://github.com/henriquebastos/django-aggregate-if.git@django-1.7

henriquebastos added a commit that referenced this pull request Nov 18, 2014
@henriquebastos henriquebastos merged commit 8311059 into master Nov 18, 2014
@henriquebastos
Copy link
Owner Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants