Skip to content

Use a Dynamodel in a ModelSerializer #111

Open
@vinceh91

Description

@vinceh91

Hi!
Is it possible to use DynaModel as a regular Django Model in a ModelSerializer?
Cause when I do so I have the exception:
"[MyDynaModel] object does not have a "_meta" attribute"

My code:

models.py

class Event(DynaModel):

    class Table:
        resource_kwargs = {
            'endpoint_url': 'http://localhost:8000'}
        name = 'Event'
        hash_key = 'a'
        read = 1
        write = 1

    class Schema:
        a = fields.Decimal()
        d = fields.String()

serializers.py

class EventSerializer(serializers.ModelSerializer):
    class Meta:
        model = Event
        fields = ('a', 'd')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions