Hi,

On 16/07/14 21:53, Pepsodent Cola wrote:
Hi,
I have been learning and developing my first Django project in Linux
Mint 14 for about 2 years.  This month I moved my Django project files
to Linux Mint 17.
When I run my unit tests then I get this error, which I don't remember
having when I was testing code in Linux Mint 14.

*IntegrityError: NOT NULL constraint failed:*
userprofile_userprofile.likes_cheese


NOT NULL constraint failed
I try to change the old code from this.

class UserProfile(models.Model):
     user = models.OneToOneField(User)
     likes_cheese = models.*BooleanField()*
     favourite_hamster_name = models.CharField(max_length=50)


It sounds looks like your operating system upgrade has upgraded Django to 1.6. In Django 1.6 you need to explicitly set default=False on your boolean fields, otherwise they default to None

>      likes_cheese = models.BooleanField(default=False)

For more info see the release notes [1]. It would be worth going through them to see if there are any other changes you should or need to make.

[1]: https://docs.djangoproject.com/en/dev/releases/1.6/#booleanfield-no-longer-defaults-to-false

Cheers,
Alasdair

--
Alasdair Nicol
Developer, MEMSET

mail: alasd...@memset.com
 web: http://www.memset.com/

Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53C6EF99.5050205%40memset.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to