Overriding save method issues

I'm trying to override default save method according to this article, but in both ways I'm getting following error:

  • while using: super(Blog, self).save(*args, **kwargs), I'm getting: name 'Blog' is not defined
  • while using: models.Model.save(self, *args, **kwargs), I'm getting: name 'self' is not defined

Here is whole class - what am I doing wrong?

Answers


  1. The call to the superclass's save method should happen in the class's save method (that line is not indented properly, so it's not within the save method.
  2. You should call super with the current class, so super(Exc, self).save(*args, **kwargs).

Need Your Help

How to generate a Binary Tree from a Labyrinth?

binary-tree binary-search maze

A matrix of 150x150 size will describe our labyrinth, so for example if the matrix were only 10x10 we would have something like this:

Bounced mails get Status header

java smtp bouncedemail

I am trying to read the Status header of a bounced email. This site explains better what I am trying...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.