I have a little problem with the user model, the model looks like this:
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
url = models.URLField(max_length = 70, blank = True, verbose_name = 'WWW')
home_address = models.TextField(blank = True, verbose_name = 'Home Adress')
user = models.ForeignKey(User, blank = True, unique = True)
def __unicode__(self):
return '%s' %(self.user)
When I open django-shell and import the user first:
u = User.objects.get(id = 1)
and then:
zm = UserProfile.objects.get(user = u)
I get an error message:
DoNotExist: UserProfile matching request does not exist.
The idea is simple: first I create a user, it works, then I want to add some information to the user, it does not work: /
nykon source
share