Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
* Fixed it so max_length get set on FieldUUID
* Fixed denormalization so it skips virtual fields on the model
* Fixed slicing to accept 0 length slices because django_rest_framework was asking for them.
  • Loading branch information
Seth Denner committed May 14, 2016
1 parent 14d3b77 commit 8d9ce5c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion djangocassandra/db/backends/cassandra/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def fetch(self, low_mark, high_mark):
if (
high_mark is not None and
low_mark is not None and
high_mark <= low_mark
high_mark < low_mark
):
raise Exception('Can\'t slice query high_mark > low_mark')

Expand Down
2 changes: 2 additions & 0 deletions djangocassandra/db/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def __init__(
if 'default' not in kwargs:
kwargs['default'] = uuid.uuid4

kwargs['max_length'] = 36

super(FieldUUID, self).__init__(
*args,
**kwargs
Expand Down
10 changes: 9 additions & 1 deletion djangocassandra/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Model as DjangoModel,
Manager
)
from django.db.models.fields import (
FieldDoesNotExist
)

from .fields import TokenPartitionKeyField
from .query import QuerySet
Expand All @@ -18,7 +21,12 @@ def denormalize(
):
field_names = origin._meta.get_all_field_names()
for name in field_names:
field = origin._meta.get_field(name)
try:
field = origin._meta.get_field(name)

except FieldDoesNotExist:
pass

setattr(
destination,
field.name,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='djangocassandra',
version='0.4.3',
version='0.4.4',
description='Cassandra support for the Django web framework',
long_description=(
'The Cassandra database backend for Django has been '
Expand Down

0 comments on commit 8d9ce5c

Please sign in to comment.