Пример #1
0
    def ready(self):
        """ Add relationship to ExtensibleNodeSerializer """
        from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

        ExtensibleNodeSerializer.add_relationship(**{
            'name': 'layer',
            'view_name': 'api_layer_detail',
            'lookup_field': 'layer.slug'
        })
Пример #2
0
    def ready(self):
        """ Add relationship to ExtensibleNodeSerializer """
        from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

        ExtensibleNodeSerializer.add_relationship(
            **{
                'name': 'layer',
                'view_name': 'api_layer_detail',
                'lookup_field': 'layer.slug'
            })
Пример #3
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies='nodeshot.core.nodes',
    module='nodeshot.community.mailing'
)


from inward import Inward
from outward import Outward

__all__ = [
    'Inward',
    'Outward',
]


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{
    'name': 'contact',
    'view_name': 'api_node_contact',
    'lookup_field': 'slug'
})
Пример #4
0
from layer import Layer

__all__ = ['Layer']

# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{
    'name': 'layer',
    'view_name': 'api_layer_detail',
    'lookup_field': 'layer.slug'
})
Пример #5
0
class LayerParticipationSettingsSerializer(serializers.ModelSerializer):
    """ Layer participation settings"""
    participation_settings = LayerSettingsSerializer(source='layer_participation_settings')

    class Meta:
        model=Node
        fields= ('name', 'slug', 'participation_settings')


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(
    'comments',
    serializer=CommentRelationSerializer,
    many=True,
    queryset='obj.comment_set.all()'
)

ExtensibleNodeSerializer.add_relationship(
    'counts',
    serializer=ParticipationSerializer,
    queryset='obj.noderatingcount'
)

ExtensibleNodeSerializer.add_relationship(
    'votes_url',
    view_name='api_node_votes',
    lookup_field='slug'
)
Пример #6
0
from nodeshot.core.base.utils import check_dependencies
from layer import Layer


__all__ = ['Layer']


check_dependencies(
    dependencies='nodeshot.core.nodes',
    module='nodeshot.core.layers'
)


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{
    'name': 'layer',
    'view_name': 'api_layer_detail',
    'lookup_field': 'layer.slug'
})
Пример #7
0
        """ Layer participation settings"""
        participation_settings = LayerSettingsSerializer(
            source='layer_participation_settings')

        class Meta:
            model = Node
            fields = ('name', 'slug', 'participation_settings')


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(
    'comments',
    serializer=CommentRelationSerializer,
    many=True,
    queryset=lambda obj, request: obj.comment_set.all())

ExtensibleNodeSerializer.add_relationship(
    'counts',
    serializer=ParticipationSerializer,
    queryset=lambda obj, request: obj.noderatingcount)

ExtensibleNodeSerializer.add_relationship('votes_url',
                                          view_name='api_node_votes',
                                          lookup_field='slug')

ExtensibleNodeSerializer.add_relationship('ratings_url',
                                          view_name='api_node_ratings',
                                          lookup_field='slug')
Пример #8
0
    class LayerParticipationSettingsSerializer(serializers.ModelSerializer):
        """ Layer participation settings"""
        participation_settings = LayerSettingsSerializer(source='layer_participation_settings')

        class Meta:
            model = Node
            fields = ('name', 'slug', 'participation_settings')


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(
    'comments',
    serializer=CommentRelationSerializer,
    many=True,
    queryset=lambda obj, request: obj.comment_set.all()
)

ExtensibleNodeSerializer.add_relationship(
    'counts',
    serializer=ParticipationSerializer,
    queryset=lambda obj, request: obj.noderatingcount
)

ExtensibleNodeSerializer.add_relationship(
    'votes_url',
    view_name='api_node_votes',
    lookup_field='slug'
)
Пример #9
0
"""
Dependencies:
    * nodeshot.core.nodes
    * nodeshot.networking.net
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies=["nodeshot.core.nodes", "nodeshot.networking.net"], module="nodeshot.networking.links")


from .link import Link


__all__ = ["Link"]


# ------ Add relationship to NodeDetailSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{"name": "links", "view_name": "api_node_links", "lookup_field": "slug"})