Django Serialize Dict Object Has No Attribute Meta

Django Serialize Dict Object Has No Attribute Meta Rating: 8,5/10 8159 reviews
Attributeerror:

Dict Object Has No Attribute Has_key

Attributeerror:
  1. Serializing Django objects¶. Django’s serialization framework provides a mechanism for “translating” Django models into other formats. Each such object has two attributes: “pk” and “model”, the latter being represented by the name of the app (“sessions”) and the lowercase name of the class Meta.
  2. Def listado_libros(request): cons=Libros.objects.values('nombre','autores_libros__nombre').
here is my models.py from django.db import models class country (models.Model): country_name = models.CharField(max_length=200, null=True) def __str__(self): return self.country_name class state (models.Model): state_name = models.CharField(max_length=200, null=True) country = models.ForeignKey(country, on_delete=models.CASCADE, null=True) def __str__(self): return self.state_name class city (models.Model): city_name = models.CharField(max_length=200, null=True) country = models.ForeignKey(country, on_delete=models.CASCADE, null=True) state = models.ForeignKey(state, on_delete=models.CASCADE, null=True) def __str__(self): return self.city_name class publication(models.Model): title= models.CharField(max_length=300, null=True) country=models.ForeignKey(country, on_delete=models.CASCADE, null=True) state=models.ForeignKey(state, on_delete=models.CASCADE, null=True) city=models.ForeignKey(city, on_delete=models.CASCADE, null=True) def __str__(self): return self.title here is my seralizers.py from rest_framework import routers, serializers, viewsets from .models import * from django.contrib.auth.models import User from rest_framework import permissions class publicationSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = publication fields = '__all__' here is my view.py from django.shortcuts import render from django.http import HttpResponse, JsonResponse from .models import * from .serializers import * from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status,mixins,generics from django.http import Http404 from rest_framework import renderers class SnippetHighlight(APIView): def get(self,request): queryset = publication.objects.select_related('country','state','city') serializer_class = publicationSerializer(queryset,many=True) return Response(serializer_class.data) here is my urls.py from django.conf.urls import url, include from django.contrib import admin from rest_framework.urlpatterns import format_suffix_patterns from api.models import * from api import views # from api.serializers import UserSerializer urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^snippets/', views.SnippetHighlight.as_view()), # url(r'^users/$', views.UserList.as_view()), # ..

On 18-08-11 17:44, MikeKJ wrote: >O segredo dos gгєnios pdf. 'dict' object has no attribute 'META'. > ▶ Local vars > /var/www/django/eco/django/core/context_processors.py in debug > if settings.DEBUG and request.META.get('REMOTE_ADDR') in > settings.INTERNAL_IPS.

Posted on