Я получаю эту ошибку из моего view.py
тип объекта «Уведомление» не имеет атрибута «объект»
и мои view.py
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from notification.models import Notification
def show_notification(request, notification_id):
n = Notification.object.get(id=notification_id)
return render_to_response('notification.html', {'notification':n})
def delete_notification(request, notification_id):
n = Notification.object.get(id=notification_id)
n.viewed = True
n.save()
а также мои models.py
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Notification(models.Model):
title = models.CharField(max_length=250)
message = models.TextField()
viewed = models.BooleanField(default=False)
user = models.ForeignKey(User, on_delete=models.DO_NOTHING)
def create_welcome_message(sender, **kwargs):
if kwargs['created']:
noti=Notification.objects.create(user=kwargs['instance'],
title="Welcome Message",
message="Thank you for singing up!")
post_save.connect(create_welcome_message, sender=User)
Я скучаю уже давно. используя этот язык. тогда помогите мне с этой ошибкой