object has no attribute ’save’
June 13, 08 byProblem Cause:
class ContactForm(models.Model):
Solution:
ModelForm only have save method
Form doesn’t have save method so
class ContactForm(forms.ModelForm):
class ContactForm(models.Model):
ModelForm only have save method
Form doesn’t have save method so
class ContactForm(forms.ModelForm):
Same problem as Integer & NULLS with the same solution.
When you have a Field: current_zip = meta.IntegerField(maxlength=5,blank=True)
django will create a not nullable field in the DB. However leaving the field blank (in admin/web) django will try and insert a NULL value in the DB.
Add null=True:
current_zip = meta.IntegerField(maxlength=5,null=True,blank=True)
The automatic admin interface is showing nothing (or a single ) in the “Select [object_type] to change” view.
You may have forgotten to create a __str__() function for your model. Django calls __str__() to find out how to display objects in the admin interface. An alternate cause is the string you return from __str__() includes brackets (an therefore looks like an html tag), and is cleaned up by the strip_tags template filter, resulting in blank entries.
Add a correct __str__() function (without brackets in the output) to all your models. Make it a habit so it becomes automatic.
You’re using SQLite3, your DATABASE_NAME is set to the database file’s full path, the database file is writeable by Apache, but you still get the above error.
Make sure Apache can also write to the parent directory of the database. SQLite needs to be able to write to this directory.
Make sure each folder of your database file’s full path does not start with number, eg. /www/4myweb/db (observed on Windows 2000).
: Cannot redeclare security_update() (previously declared in /home/freelap5/public_html/index.php:13) in /home/freelap5/public_html/index.php on line 27