Skip to content

Commit

Permalink
Resolving Merge problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfonceca committed Dec 4, 2013
2 parents 535869d + 717dbcc commit b6cb65f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
12 changes: 7 additions & 5 deletions hstore_flattenfields/db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __new__(cls, name, bases, attrs):
new_class = super(HStoreModelMeta, cls).__new__(
cls, name, bases, attrs
)

# override getattr/setattr/delattr
old_getattribute = new_class.__getattribute__

Expand Down Expand Up @@ -280,7 +280,7 @@ def by_group(dynamic_field):
return True
else:
return False

return filter(by_group, dynamic_fields)

@property
Expand All @@ -299,7 +299,7 @@ def by_group(content_pane):
return True
else:
return False

return filter(by_group, content_panes)


Expand Down Expand Up @@ -376,6 +376,8 @@ def related_instances(self):

from hstore_flattenfields.models import DynamicFieldGroup
QueryModel = instances.query.model


if QueryModel != DynamicFieldGroup and \
issubclass(QueryModel, DynamicFieldGroup):
instances = map(lambda x: x.dynamicfieldgroup_ptr, instances)
Expand Down Expand Up @@ -423,9 +425,9 @@ def by_groups(content_pane):
# return content_pane.content_type.model == self.__class__.__name__.lower()

# content_panes = cache.get('content_panes', [])

# content_panes = filter(by_refer, content_panes)
# content_panes = filter(by_group, content_panes)
# content_panes = filter(by_dfields, content_panes)

# return content_panes
2 changes: 1 addition & 1 deletion hstore_flattenfields/db/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def values(self, *fields):
if not fields:
fields = self.all_field_names
return parse_queryset(
self.model,
self.model,
super(FlattenFieldsFilterQuerySet, self).values(
*fields
)
Expand Down
1 change: 0 additions & 1 deletion hstore_flattenfields/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from django_orm.postgresql import hstore
from django_extensions.db.fields import AutoSlugField
# from caching.base import CachingManager, CachingMixin

from db.base import (
HStoreModel,
Expand Down
37 changes: 18 additions & 19 deletions hstore_flattenfields/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
used in hstore_flattenfields application.
:copyright: 2012, multmeio (http://www.multmeio.com.br)
:author: 2012, Luís Antônio Araújo Brito <iuridiniz@gmail.com>
:author: 2012, Luís Araújo <caitifbrito@gmail.com>
:license: BSD, see LICENSE for more details.
"""

Expand Down Expand Up @@ -412,22 +412,21 @@ def build_flattenfields_object(obj):
[<ContentPane: Main Info>]
>>> DynamicField.objects.all().delete()
"""
from hstore_flattenfields.models import (
DynamicField,
ContentPane
)
content_panes = metafields = []
metafields = DynamicField.objects.filter(
refer=obj.__class__.__name__
).order_by('pk')
content_panes = ContentPane.objects.filter(
Q(content_type__model=obj.__class__.__name__.lower())
)
setattr(obj, '_dynamic_fields', metafields)
setattr(obj, '_content_panes', content_panes)
setattr(obj._meta, '_model_dynamic_fields',
try:
from hstore_flattenfields.models import (
DynamicField, ContentPane
)
assert dynamic_field_table_exists()
except (AssertionError, ImportError):
content_panes = metafields = []
else:
metafields = DynamicField.objects.filter(
refer=obj.__class__.__name__
).order_by('pk')
content_panes = ContentPane.objects.filter(
Q(content_type__model=obj.__class__.__name__.lower())
)
setattr(obj, '_dynamic_fields', filter(lambda x: x, metafields))
setattr(obj, '_content_panes', filter(lambda x: x, content_panes))
setattr(obj._meta, '_model_dynamic_fields',
map(create_field_from_instance, metafields))
# try:
# assert dynamic_field_table_exists()
# except (AssertionError, ImportError):
# else:

0 comments on commit b6cb65f

Please sign in to comment.