I am adding a system to leave "notifications" for users that can be displayed the next time they log in. I created a simple Notification class in the models.py file. I have this UserInfo class (in the same models.py) to add on some attributes to Django's existing user system as part of socialauth:
class UserInfo(models.Model):
user = models.OneToOneField(User, unique=True)
...
reputation = models.IntegerField(null=True, blank=True)
def add_notification(message):
notification = Notification(user=self.user, message=message)
notification.save
When I try it out in the console I end up with this:
>>> user = User.objects.get(id=14)
>>> user.userinfo.add_notification('you are an awesome intern!')
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: add_notification() takes exactly 1 argument (2 given)
>>>
What am I missing here? I'm kind of a Django noob so maybe it's something easy. Thanks!