Пример #1
0
def save_movie_from_row(movie_row):
    movie = Movie()
    movie.movie_id = movie_row[0]
    movie.tmdbId = movie_row[1]
    movie.name = movie_row[2]
    movie.genre = movie_row[3]
    movie.save()
Пример #2
0
 def writeModel(self, root, title, year, genre, source, cover, desc):
     obj = Movie()
     obj.title = title
     obj.year = year
     obj.genre = genre
     obj.source = source
     obj.cover = cover
     obj.description = desc
     obj.save()
Пример #3
0
 def handle(self, *args, **options):
     if Movie.objects.exists():
         print('Movie data already loaded...exiting.')
         print(ALREADY_LOADED_ERROR_MESSAGE)
         return
     print("Creating movie data")
     for row in DictReader(open('./movies.csv')):
         movie = Movie()
         movie.title = row['Title']
         #movie.movie_poster_image = models.ImageField(blank=True, null=True,
         #upload_to="posters/")
         movie.release_date = row['Release_date']
         movie.director = row['Director']
         movie.rating = row['Rating']
         movie.genre = row['Genre']
         movie.description = row['Description']
         movie.save()