navyad
navyad

Reputation: 3870

Django: AttributeError: class Meta has no attribute 'model'

Using Django 1.7.2 and djangorestframework==3.0.2

Getting error AttributeError: class Meta has no attribute 'model' for

class NotificationCountSerializer(serializers.Serializer):
   ------
   ------

    class Meta:
        fields = ('drivers_count', 'vehicles_count', 'maps_count')

although same code working for Django==1.8 and djangorestframework==3.2.3

Is this the issue with django or djangorestframework version ?

Upvotes: 1

Views: 831

Answers (1)

user4674730
user4674730

Reputation:

The issue is with your version of Django.

From the 1.8 changelog:


What’s new in Django 1.8

Model._meta API

Django now has a formalized API for Model._meta, providing an officially supported way to retrieve fields and filter fields based on their attributes.

The Model._meta object has been part of Django since the days of pre-0.96 “Magic Removal” – it just wasn’t an official, stable API. In recognition of this, we’ve endeavored to maintain backwards-compatibility with the old API endpoint where possible. However, API endpoints that aren’t part of the new official API have been deprecated and will eventually be removed. A guide to migrating from the old API to the new API has been provided

Upvotes: 1

Related Questions