use ox.django, drop python-oxdjango, add Bin/Event/Place
This commit is contained in:
parent
fc2951eb06
commit
c955215c17
18 changed files with 140 additions and 83 deletions
|
@ -22,9 +22,9 @@ try:
|
|||
except ImportError:
|
||||
from django.utils import simplejson as json
|
||||
|
||||
from oxdjango.decorators import login_required_json
|
||||
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from oxdjango.http import HttpFileResponse
|
||||
from ox.django.decorators import login_required_json
|
||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from ox.django.http import HttpFileResponse
|
||||
import ox
|
||||
|
||||
import models
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.shortcuts import render_to_response, get_object_or_404, get_list_or_
|
|||
from django.template import RequestContext
|
||||
from django.conf import settings
|
||||
|
||||
from oxdjango.shortcuts import json_response, render_to_json_response, get_object_or_404_json
|
||||
from ox.django.shortcuts import json_response, render_to_json_response, get_object_or_404_json
|
||||
|
||||
import models
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class Migration(SchemaMigration):
|
|||
db.add_column('archive_file', 'available', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default=False)
|
||||
|
||||
# Changing field 'File.info'
|
||||
db.alter_column('archive_file', 'info', self.gf('oxdjango.fields.DictField')())
|
||||
db.alter_column('archive_file', 'info', self.gf('ox.django.fields.DictField')())
|
||||
|
||||
# Deleting field 'fileinstance.published'
|
||||
db.delete_column('archive_fileinstance', 'published')
|
||||
|
@ -184,7 +184,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -281,9 +281,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -47,7 +47,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -144,9 +144,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -50,7 +50,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -147,9 +147,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -32,7 +32,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -129,9 +129,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -45,7 +45,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -150,9 +150,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -72,7 +72,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -162,9 +162,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -33,7 +33,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -122,9 +122,9 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
|
|
|
@ -31,7 +31,7 @@ class Migration(SchemaMigration):
|
|||
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
|
@ -120,10 +120,10 @@ class Migration(SchemaMigration):
|
|||
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'imdb': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'itemId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'metadata': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||
'poster': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||
|
|
|
@ -15,7 +15,7 @@ from django.core.files.base import ContentFile
|
|||
from django.utils import simplejson as json
|
||||
from django.conf import settings
|
||||
|
||||
from oxdjango import fields
|
||||
from ox.django import fields
|
||||
import ox
|
||||
from ox import stripTags
|
||||
from ox.normalize import canonicalTitle, canonicalName
|
||||
|
|
|
@ -22,9 +22,9 @@ try:
|
|||
except ImportError:
|
||||
from django.utils import simplejson as json
|
||||
|
||||
from oxdjango.decorators import login_required_json
|
||||
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from oxdjango.http import HttpFileResponse
|
||||
from ox.django.decorators import login_required_json
|
||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from ox.django.http import HttpFileResponse
|
||||
import ox
|
||||
|
||||
import models
|
||||
|
|
|
@ -18,7 +18,7 @@ from django.core.files.base import ContentFile
|
|||
from django.utils import simplejson as json
|
||||
from django.conf import settings
|
||||
|
||||
from oxdjango import fields
|
||||
from ox.django import fields
|
||||
import ox
|
||||
from ox import stripTags
|
||||
from ox.normalize import canonicalTitle, canonicalName
|
||||
|
@ -30,36 +30,19 @@ import utils
|
|||
from archive import extract
|
||||
|
||||
|
||||
class Property(models.Model):
|
||||
class Bin(models.Model):
|
||||
name = models.CharField(null=True, max_length=255, unique=True)
|
||||
title = models.CharField(null=True, max_length=255)
|
||||
#types: string, person, role, location, date, array
|
||||
type = models.CharField(null=True, max_length=255)
|
||||
array = models.BooleanField(default=False)
|
||||
position = models.IntegerField(default=0)
|
||||
|
||||
#sort values: title, string, integer, float, date
|
||||
sort = models.CharField(null=True, max_length=255)
|
||||
|
||||
totals = models.BooleanField(default=False)
|
||||
admin = models.BooleanField(default=False)
|
||||
|
||||
def json(self):
|
||||
j = {}
|
||||
for key in ('type', 'sort', 'title', 'array', 'totals', 'admin'):
|
||||
value = getattr(self, key)
|
||||
if value:
|
||||
j[key] = value
|
||||
return j
|
||||
|
||||
class Bin(models.Model):
|
||||
name = models.CharField(null=True, max_length=255, unique=True)
|
||||
title = models.CharField(null=True, max_length=255)
|
||||
#types: keyword, location, text
|
||||
#text, string, string from list(fixme), event, place, person
|
||||
type = models.CharField(null=True, max_length=255)
|
||||
position = models.IntegerField(default=0)
|
||||
|
||||
overlapping = models.BooleanField(default=True)
|
||||
enabled = models.BooleanField(default=True)
|
||||
|
||||
enabled = models.BooleanField(default=True)
|
||||
public = models.BooleanField(default=True) #false=users only see there own bins
|
||||
subtitle = models.BooleanField(default=True) #bis can be displayed as subtitle, only one bin
|
||||
|
||||
find = models.BooleanField(default=True)
|
||||
#words / item duration(wpm), total words, cuts per minute, cuts, number of layers, number of layers/duration
|
||||
|
@ -263,6 +246,28 @@ def getItem(info):
|
|||
item.save()
|
||||
return item
|
||||
|
||||
class ItemProperty(models.Model):
|
||||
name = models.CharField(null=True, max_length=255, unique=True)
|
||||
title = models.CharField(null=True, max_length=255)
|
||||
#text, string, string from list(fixme), event, place, person
|
||||
type = models.CharField(null=True, max_length=255)
|
||||
array = models.BooleanField(default=False)
|
||||
position = models.IntegerField(default=0)
|
||||
|
||||
#sort values: title, string, integer, float, date
|
||||
sort = models.CharField(null=True, max_length=255)
|
||||
|
||||
totals = models.BooleanField(default=False)
|
||||
admin = models.BooleanField(default=False)
|
||||
|
||||
def json(self):
|
||||
j = {}
|
||||
for key in ('type', 'sort', 'title', 'array', 'totals', 'admin'):
|
||||
value = getattr(self, key)
|
||||
if value:
|
||||
j[key] = value
|
||||
return j
|
||||
|
||||
class Item(models.Model):
|
||||
person_keys = ('director', 'writer', 'producer', 'editor', 'cinematographer', 'actor', 'character')
|
||||
facet_keys = person_keys + ('country', 'language', 'genre', 'keyword')
|
||||
|
@ -896,9 +901,14 @@ def getPersonSort(name):
|
|||
|
||||
class Person(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
imdbId = models.CharField(max_length=7, blank=True)
|
||||
name_sort = models.CharField(max_length=200)
|
||||
|
||||
#FIXME: how to deal with aliases
|
||||
aliases = fields.TupleField(default=[])
|
||||
|
||||
|
||||
imdbId = models.CharField(max_length=7, blank=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ('name_sort', )
|
||||
|
||||
|
@ -928,12 +938,20 @@ class Person(models.Model):
|
|||
def json(self):
|
||||
return self.name
|
||||
|
||||
class Location(models.Model):
|
||||
name = models.CharField(max_length=200, unique=True)
|
||||
manual = models.BooleanField(default=False)
|
||||
items = models.ManyToManyField(Item, related_name='locations_all')
|
||||
#fixme: geo data
|
||||
class Place(models.Model):
|
||||
'''
|
||||
Places are named locations, they should have geographical information attached to them.
|
||||
'''
|
||||
|
||||
name = models.CharField(max_length=200, unique=True)
|
||||
name_sort = models.CharField(max_length=200)
|
||||
manual = models.BooleanField(default=False)
|
||||
items = models.ManyToManyField(Item, related_name='places')
|
||||
|
||||
#FIXME: how to deal with aliases
|
||||
aliases = fields.TupleField(default=[])
|
||||
|
||||
#FIXME: geo data, is this good enough?
|
||||
lat_sw = models.FloatField(default=0)
|
||||
lng_sw = models.FloatField(default=0)
|
||||
lat_ne = models.FloatField(default=0)
|
||||
|
@ -943,7 +961,7 @@ class Location(models.Model):
|
|||
area = models.FloatField(default=-1)
|
||||
|
||||
class Meta:
|
||||
ordering = ('name', )
|
||||
ordering = ('name_sort', )
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
@ -951,6 +969,46 @@ class Location(models.Model):
|
|||
def json(self):
|
||||
return self.name
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.name_sort:
|
||||
self.name_sort = self.name
|
||||
|
||||
#update center
|
||||
self.lat_center = ox.location.center(self.lat_sw, self.lat_ne)
|
||||
self.lng_center = ox.location.center(self.lng_sw, self.lng_ne)
|
||||
|
||||
#update area
|
||||
self.area = location.area(self.lat_sw, self.lng_sw, self.lat_ne, self.lng_ne)
|
||||
|
||||
super(Place, self).save(*args, **kwargs)
|
||||
|
||||
class Event(models.Model):
|
||||
'''
|
||||
Events are events in time that can be once or recurring,
|
||||
From Mondays to Spring to 1989 to Roman Empire
|
||||
'''
|
||||
name = models.CharField(null=True, max_length=255, unique=True)
|
||||
name_sort = models.CharField(null=True, max_length=255, unique=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ('name_sort', )
|
||||
|
||||
#FIXME: how to deal with aliases
|
||||
aliases = fields.TupleField(default=[])
|
||||
|
||||
#once|year|week|day
|
||||
recurring = models.IntegerField(default=0)
|
||||
|
||||
#start yyyy-mm-dd|mm-dd|dow 00:00|00:00
|
||||
#end yyyy-mm-dd|mm-dd|dow 00:00|00:01
|
||||
start = models.CharField(null=True, max_length=255)
|
||||
end = models.CharField(null=True, max_length=255)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.name_sort:
|
||||
self.name_sort = self.name
|
||||
super(Event, self).save(*args, **kwargs)
|
||||
|
||||
class ReviewWhitelist(models.Model):
|
||||
name = models.CharField(max_length=255, unique=True)
|
||||
url = models.CharField(max_length=255, unique=True)
|
||||
|
@ -1005,7 +1063,7 @@ class Layer(models.Model):
|
|||
|
||||
type = models.CharField(blank=True, max_length=255)
|
||||
value = models.TextField()
|
||||
|
||||
|
||||
#FIXME: relational layers, Locations, clips etc
|
||||
#location = models.ForeignKey('Location', default=None)
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ try:
|
|||
except ImportError:
|
||||
from django.utils import simplejson as json
|
||||
|
||||
from oxdjango.decorators import login_required_json
|
||||
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from oxdjango.http import HttpFileResponse
|
||||
from ox.django.decorators import login_required_json
|
||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from ox.django.http import HttpFileResponse
|
||||
import ox
|
||||
|
||||
import models
|
||||
|
|
|
@ -94,8 +94,8 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'oxdjango.middleware.ExceptionMiddleware',
|
||||
'oxdjango.middleware.ChromeFrameMiddleware',
|
||||
'ox.django.middleware.ExceptionMiddleware',
|
||||
'ox.django.middleware.ChromeFrameMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'pandora.urls'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import os
|
||||
|
||||
from django.conf.urls.defaults import *
|
||||
from oxdjango.http import HttpFileResponse
|
||||
from ox.django.http import HttpFileResponse
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ from django.utils import simplejson as json
|
|||
from django.conf import settings
|
||||
from django.core.mail import send_mail, BadHeaderError
|
||||
|
||||
from oxdjango.shortcuts import render_to_json_response, json_response
|
||||
from oxdjango.decorators import login_required_json
|
||||
from ox.django.shortcuts import render_to_json_response, json_response
|
||||
from ox.django.decorators import login_required_json
|
||||
|
||||
import models
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
South
|
||||
chardet
|
||||
-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox
|
||||
-e bzr+http://code.0x2620.org/python-oxdjango/#egg=python-oxdjango
|
||||
-e bzr+http://code.0x2620.org/oxtimeline/#egg=oxtimeline
|
||||
simplejson
|
||||
#-e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields
|
||||
|
|
Loading…
Reference in a new issue