oxdata/poster/views.py
2009-07-15 18:39:28 +02:00

36 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os.path
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.template import RequestContext
from oxdata.utils.shortcuts import render_to_json_response
from oxdata.lookup.models import MovieId
import models
def poster(request):
#FIXME: get MovieId from provided id and redirect to poster url
if 'imdb' in request.GET:
imdbId = request.GET['imdb']
movie_id = MovieId.objects.get(imdb_id=imdbId)
elif 'oxdb' in request.GET:
oxdbId = request.GET['oxdb']
movie_id = MovieId.objects.get(oxdb_id=oxdbId)
context = RequestContext(request, {'imdb': imdbId})
return render_to_response('poster.html', context)
def poster_json(request):
#FIXME: get MovieId from provided id and redirect to poster url
if 'imdb' in request.GET:
imdbId = request.GET['imdb']
movie_id = MovieId.objects.get(imdb_id=imdbId)
elif 'oxdb' in request.GET:
oxdbId = request.GET['oxdb']
movie_id = MovieId.objects.get(oxdb_id=oxdbId)
json = models.getPosters(movie_id)
return render_to_json_response(json)