Skip to content
Advertisement

Tag: django-rest-framework

Django/Wagtail Snippet Serializer in API

I have added wagtail CMS’s blog author in my ‘models.py’ also exposed it in API, but it’s showing like this in API Here’s the models.py code How do I serialize like this show author name, website, image and id? I tried to Serialize the BlogAuthor And here is the API field APIField(“blog_authors”, serializer=AuthorSerializer(many=True)), When I runserver I got this error

python manage.py collectstatic error: cannot find rest_framework bootstrap.min.css.map (from book ‘Django for APIs’)

I am reading the book ‘Django for APIs’ from ‘William S. Vincent’ (current edition for Django 4.0) In chapter 4, I cannot run successfully the command python manage.py collectstatic. I get the following error: I have the exact same settings like in the book in settings.py: I couldn’t find any explanation for it. maybe someone can point me in the

serializer not being called AttributeError: ‘str’ object has no attribute ‘_meta’

I modified the Auth User by using AbstractUser Class. Registered it in settings. Everything else is working I can create an instance using the User Model BUT The Problem comes during the serialization. My serializer doesn’t throw any error, but any time I try and use the serializer.data I get AttributeError: ‘str’ object has no attribute ‘_meta’. User Model Custom

Advertisement