Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a Dynamodel in a ModelSerializer #111

Open
vinceh91 opened this issue Jan 11, 2023 · 0 comments
Open

Use a Dynamodel in a ModelSerializer #111

vinceh91 opened this issue Jan 11, 2023 · 0 comments

Comments

@vinceh91
Copy link

vinceh91 commented Jan 11, 2023

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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant