some admin stuff

This commit is contained in:
j 2009-07-13 16:44:09 +02:00
parent b02d3ec556
commit 840c2f6b72
6 changed files with 28 additions and 4 deletions

10
lookup/admin.py Normal file
View file

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import models
from django.contrib import admin
class MovieIdAdmin(admin.ModelAdmin):
search_fields = ['title', 'imdb_id']
admin.site.register(models.MovieId, MovieIdAdmin)

View file

@ -27,8 +27,8 @@ class MovieId(models.Model):
title = models.CharField(max_length=1000, blank=True, default='') title = models.CharField(max_length=1000, blank=True, default='')
year = models.CharField(max_length=4, blank=True, default='') year = models.CharField(max_length=4, blank=True, default='')
director = models.CharField(max_length=1000, blank=True, default='') director = models.CharField(max_length=1000, blank=True, default='')
series_title = models.TextField(blank=True, default='') series_title = models.CharField(max_length=1000, blank=True, default='')
episode_title = models.TextField(blank=True, default='') episode_title = models.CharField(max_length=1000, blank=True, default='')
season = models.IntegerField(default=-1) season = models.IntegerField(default=-1)
episode = models.IntegerField(default=-1) episode = models.IntegerField(default=-1)
@ -39,7 +39,6 @@ class MovieId(models.Model):
wikipedia_id = models.CharField(unique=True, max_length=255, blank=True, null=True, default=None) wikipedia_id = models.CharField(unique=True, max_length=255, blank=True, null=True, default=None)
criterion_id = models.IntegerField(unique=True, blank=True, null=True, default=None) criterion_id = models.IntegerField(unique=True, blank=True, null=True, default=None)
impawards_id = models.CharField(max_length=255, unique=True, blank=True, null=True, default=None) impawards_id = models.CharField(max_length=255, unique=True, blank=True, null=True, default=None)
rottentomatoes_id = models.CharField(max_length=255, unique=True, blank=True, null=True, default=None)
#FIXME: look into other ids #FIXME: look into other ids
#what about tv.com ids/urls for tv episodes #what about tv.com ids/urls for tv episodes
@ -47,7 +46,9 @@ class MovieId(models.Model):
#movieposterdb can be mapped via imdbid and does not need to be saved here #movieposterdb can be mapped via imdbid and does not need to be saved here
def __unicode__(self): def __unicode__(self):
return self.imdb_id id = self.imdb_id
if id: id = self.id
return '%s (%s)' % (self.title, id)
def updateFromWikipedia(self): def updateFromWikipedia(self):
if self.wikipedia_id: if self.wikipedia_id:

10
poster/admin.py Normal file
View file

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import models
from django.contrib import admin
class PosterAdmin(admin.ModelAdmin):
search_fields = ['url', 'movie_id__title', 'movie_id__imdb_id']
admin.site.register(models.Poster, PosterAdmin)

View file

@ -14,3 +14,4 @@ class Poster(models.Model):
movie_id = models.ForeignKey(MovieId, related_name='poster') movie_id = models.ForeignKey(MovieId, related_name='poster')
url = models.CharField(max_length=255) url = models.CharField(max_length=255)

View file

@ -10,4 +10,5 @@ from oxdata.utils.shortcuts import render_to_json_response
def poster(request): def poster(request):
#FIXME: get MovieId from provided id and redirect to poster url #FIXME: get MovieId from provided id and redirect to poster url
return

View file

@ -83,6 +83,7 @@ INSTALLED_APPS = (
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.sites',
'django.contrib.admin',
'django.contrib.humanize', 'django.contrib.humanize',
'oxdata.criterion', 'oxdata.criterion',
'oxdata.impawards', 'oxdata.impawards',