Hi
You need to use exceptions to solve this problem
try:
movieObject=Movie.objects.get(.....)
except Movie.DoesNotExist:
#make the insert query
movieObject=Movie()
BlackBerry de movistar, allí donde estés está tu oficin@
-----Original Message-----
From: Hélio Miranda <[email protected]>
Sender: [email protected]
Date: Sat, 4 May 2013 06:49:48
To: <[email protected]>
Reply-To: [email protected]
Subject: Re: Django - Query
That was it, but now I'm the problem is that, I wonder if there is a movie
on BD, but there insert.
I am trying as follows, but I do not get:
And it gives me the following error: Movie matching query does not exist.
The film is not clear ...
Does anyone know what I'm doing wrong?
Código (Python):
if Movie.objects.get(MovieTitle='Avatar').exists():
reportMovie.MovieTitle = 'Avatar'
reportMovie.MovieTitlePT = line["Movie Name (PT)"]
reportMovie.save()
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.