12👍
✅
As NOT NULL constraint is getting failed hence error.
Either make null=True
album = models.OneToOneField(Album,on_delete=models.CASCADE, null=True)
Or use signals to connect the user with the album.
1👍
Since:
1) all the fields on album are nullable or have default values and
2) you can pass a callable to the default arg
This should work:
album = models.OneToOneField(Album, on_delete=models.CASCADE, default=Album.objects.create)
- How to release the occupied GPU memory when calling keras model by Apache mod_wsgi django?
- Catching exceptions in django templates
Source:stackexchange.com