type Objekt 'X' hat kein Attribut 'Objekte'

Ich benutze Django und Django Rest Framework 2.4.0

Ich erhalte den Attributfehlertype object 'Notification' has no attribute 'objects'

models.py

class Notification(models.Model):
    NOTIFICATION_ID = models.AutoField(primary_key=True)
    user = models.ForeignKey(User, related_name='user_notification')
    type = models.ForeignKey(NotificationType)
    join_code = models.CharField(max_length=10, blank=True)
    requested_userid = models.CharField(max_length=25, blank=True)
    datetime_of_notification = models.DateTimeField()
    is_active = models.BooleanField(default=True)

serializers.py:

class NotificationSerializer(serializers.ModelSerializer):
    class Meta:
        model = Notification
        fields = (
            'type',
            'join_code',
            'requested_userid',
            'datetime_of_notification'
        )

api.py:

class Notification(generics.ListAPIView):
    serializer_class = NotificationSerializer
    def get_queryset(self):
        notifications = Notification.objects.all()
        return notifications

Kann mir jemand helfen, das herauszufinden? Es schlägt fehl inapi.py an der Linienotifications = Notification.objects.all()

Antworten auf die Frage(4)

Ihre Antwort auf die Frage