why create and get_or_create  can't use id to set foerign key ?

for example I can't write like below:

Star.objects.get_or_create(user=request.user,title_id=title_id)

I have to write like this:

    try:
        Star.objects.get(user=request.user,title=title_id)
    except Star.DoesNotExist:
        Star(user=request.user,title_id=title_id).save()



-- 


博客:http://zsp.javaeye.com/
专业:生物医学工程+计算机科学与技术
技能:C++(STL,BOOST) Python(Django) HTML+CSS AJAX
-- 张沈鹏

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

Reply via email to