r4fek / django-cassandra-engine

Django Cassandra Engine - the Cassandra backend for Django
BSD 2-Clause "Simplified" License
364 stars 85 forks source link

Can't delete from admin - You cannot .filter() on a DjangoCassandraQuerySet which has been ordered using python #133

Open brylor opened 5 years ago

brylor commented 5 years ago

If I try to delete from the admin:

settings.py has CASSANDRA_FALLBACK_ORDER_BY_PYTHON = True

I get:

` Request Method: POST

http://192.168.0.1:8080/admin/accounts/accountmodel/ 1.11.21 NotImplementedError You cannot .filter() on a DjangoCassandraQuerySet which has been ordered using python /usr/lib/python2.7/site-packages/django_cassandra_engine/models/init.py in _raise_not_implemented, line 597 /bin/python 2.7.14 ['/root/whitelist', '/usr/lib/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib/python2.7/site-packages'] Thu, 6 Jun 2019 19:39:43 +0000 `

If I set it to CASSANDRA_FALLBACK_ORDER_BY_PYTHON = False I get:

` Request Method: GET

http://192.168.0.1:8080/admin/accounts/accountmodel/ 1.11.21 QueryException Can't order by the first primary key (partition key), clustering (secondary) keys only To enable fallback order_by() python implementation, set "CASSANDRA_FALLBACK_ORDER_BY_PYTHON = True" in Django Settings. /usr/lib/python2.7/site-packages/django_cassandra_engine/models/init.py in order_by, line 762 /bin/python 2.7.14 ['/root/whitelist', '/usr/lib/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib/python2.7/site-packages'] Thu, 6 Jun 2019 19:43:15 +0000 `

my model is:

class AccountModel(DjangoCassandraModel): pk = columns.UUID(primary_key=True, default=uuid.uuid4) account_id = columns.Text() divison_id = columns.Text()

alexander-jacob commented 3 years ago

Same problem here