keep lookup.modles and movie.models in sync

This commit is contained in:
j 2013-07-24 10:27:30 +02:00
parent 000d913da1
commit 85712a63b5

View file

@ -16,6 +16,8 @@ import ox.web.imdb
import ox.web.wikipedia import ox.web.wikipedia
import ox.web.allmovie import ox.web.allmovie
import movie.models
from modules import get_info from modules import get_info
oxdb_api = ox.API('http://0xdb.org/api/') oxdb_api = ox.API('http://0xdb.org/api/')
@ -105,6 +107,9 @@ class MovieId(models.Model):
#if not self.oxdb_id: #if not self.oxdb_id:
# self.gen_oxdb_id() # self.gen_oxdb_id()
self.save() self.save()
if self.imdb_id:
m, created = movie.models.Imdb.objects.get_or_create(imdb=self.movie_id.imdb_id)
m.update()
def gen_oxdb_id(self): def gen_oxdb_id(self):
self.oxdb_id = ox.get_oxid( self.oxdb_id = ox.get_oxid(