Reputation: 11
Why attribute in my model class where
class Tour_Cart(models.Model):
tours=models.ForeignKey(Tours,on_delete=models.SET_NULL,blank=True,null=True)
Throws error:
AttributeError: 'function' object has no attribute 'NULL'
Why so?
Any help will be appreciated?
Upvotes: 0
Views: 445
Reputation: 4194
I think you just missing on SET.NULL
, it should be on_delete=models.SET_NULL
Upvotes: 2
Reputation: 959
Why not use on_delete=models.CASCADE
?
Also you're missing (models.Model)
from your class declaration.
Upvotes: 0