Im sure this is probably a simple answer, but I cannot see anything wrong with this!
Im just trying to save a record, and its saying Cannot assign "<User: jason.kinnear>": "Confirmation.user" must be a "User" instance.
This is the code:
u = User.objects.get(pk=18)
cr = Confirmation(details='...', user=u).save()
Thanks in advance
EDIT: Model Definition for Confirmation
class Confirmation(models.Model):
number = models.IntegerField(null=True, blank=True)
user = models.ForeignKey('User')
details = models.CharField(max_length=250)
time = models.DateTimeField(auto_now_add=True)
I have tried both
user = models.ForeignKey('User')
and
user = models.ForeignKey(User)
Im not too sure of the difference to be honest
EDIT 2: The User class has been extended like this:
from django.contrib.auth.models import User as BaseUser
class User(BaseUser):
"""Extra user information"""
location = models.ForeignKey('Location', null=True, blank=True)
defaults = models.CharField(null=True, blank=True)