hi

np, it appears I found the solution, just needed to call save() on
foreignkey before inserting new row into database:
uid = user_list.objects.get(user_id=request.session['uid']);
uid.save()

Is this a correct way of creating new row which has 1-2 foreignkeys ?

On Feb 12, 4:03 pm, webzy <angelina.fi...@gmail.com> wrote:
> Maybe your form has user_id instead of user_id_id as id?
>
> On Feb 12, 3:20 am, keeper <mydomainkee...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello guys,
>
> > executing this code below from shell is ok, updates database and
> > inserts the proper values:
>
> > sub_domains(user_id=user_list.objects.get(user_id=1001),
> > domain=domains.objects.get(domain='domain'),
> > sub_domain='boqooooo8').save()
>
> > But, trying to call the same code within a django views. I'm getting
> > "1048, "Column 'user_id_id' cannot be null""
>
> > models:
>
> > class sub_domains(models.Model):
> >     user_id = models.ForeignKey(user_list, to_field='user_id')
> >     domain = models.ForeignKey(domains, to_field='domain')
> >     sub_domain = models.CharField(max_length=64)
>
> > What am I doing wrong ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to