merge
This commit is contained in:
commit
cf44cc885d
72 changed files with 147 additions and 649 deletions
0
pandora/app/management/__init__.py
Normal file
0
pandora/app/management/__init__.py
Normal file
0
pandora/app/management/commands/__init__.py
Normal file
0
pandora/app/management/commands/__init__.py
Normal file
15
pandora/app/management/commands/update_static.py
Normal file
15
pandora/app/management/commands/update_static.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from ... import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
"""
|
||||
help = 'update static files'
|
||||
args = ''
|
||||
|
||||
def handle(self, **options):
|
||||
models.update_static()
|
||||
|
|
@ -10,6 +10,7 @@ import thread
|
|||
from django.db import models
|
||||
from django.conf import settings
|
||||
import ox.jsonc
|
||||
from ox.utils import json
|
||||
|
||||
_win = (sys.platform == "win32")
|
||||
|
||||
|
|
@ -52,3 +53,28 @@ def reloader_thread():
|
|||
time.sleep(1)
|
||||
|
||||
thread.start_new_thread(reloader_thread, ())
|
||||
|
||||
def update_static():
|
||||
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
|
||||
if os.path.exists(oxjs_build):
|
||||
os.system(oxjs_build)
|
||||
|
||||
data = ''
|
||||
js = []
|
||||
pandora_js = os.path.join(settings.STATIC_ROOT, 'js/pandora.js')
|
||||
pandora_json = os.path.join(settings.STATIC_ROOT, 'json/pandora.json')
|
||||
for root, folders, files in os.walk(os.path.join(settings.STATIC_ROOT, 'js/pandora')):
|
||||
for f in files:
|
||||
js.append(os.path.join(root, f)[len(settings.STATIC_ROOT)+1:])
|
||||
with open(os.path.join(root, f)) as j:
|
||||
data += j.read() + '\n'
|
||||
|
||||
print 'write', pandora_js
|
||||
with open(pandora_js, 'w') as f:
|
||||
#data = ox.js.minify(data)
|
||||
f.write(data)
|
||||
|
||||
print 'write', pandora_json
|
||||
with open(pandora_json, 'w') as f:
|
||||
json.dump(sorted(js), f, indent=2)
|
||||
|
||||
|
|
|
|||
|
|
@ -91,3 +91,4 @@ def redirect_url(request, url):
|
|||
return redirect(url)
|
||||
else:
|
||||
return HttpResponse('<script>document.location.href=%s;</script>'%json.dumps(url))
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
from django.contrib import admin
|
||||
|
||||
from forms import FileAdminForm, InstanceAdminForm
|
||||
import models
|
||||
|
||||
|
||||
|
|
@ -15,13 +14,11 @@ class FileAdmin(admin.ModelAdmin):
|
|||
def itemId(self, obj):
|
||||
return '%s'%(obj.item.itemId)
|
||||
|
||||
form = FileAdminForm
|
||||
|
||||
admin.site.register(models.File, FileAdmin)
|
||||
|
||||
|
||||
class InstanceAdmin(admin.ModelAdmin):
|
||||
search_fields = ['path', 'volume__name', 'file__oshash']
|
||||
form = InstanceAdminForm
|
||||
|
||||
admin.site.register(models.Instance, InstanceAdmin)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from ajax_filtered_fields.forms import ForeignKeyByLetter
|
||||
from django.conf import settings
|
||||
from django import forms
|
||||
|
||||
|
|
@ -6,29 +5,3 @@ import models
|
|||
from item.models import Item
|
||||
|
||||
|
||||
ajax_filtered_js = (
|
||||
settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js",
|
||||
settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js",
|
||||
settings.STATIC_URL + 'js/jquery/jquery.js',
|
||||
settings.STATIC_URL + 'js/ajax_filtered_fields.js',
|
||||
)
|
||||
|
||||
|
||||
class FileAdminForm(forms.ModelForm):
|
||||
item = ForeignKeyByLetter(Item, field_name='itemId')
|
||||
|
||||
class Meta:
|
||||
model = models.File
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
|
||||
|
||||
class InstanceAdminForm(forms.ModelForm):
|
||||
file = ForeignKeyByLetter(models.File, field_name='path')
|
||||
|
||||
class Meta:
|
||||
model = models.Instance
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
|
|
|
|||
|
|
@ -1,20 +1,2 @@
|
|||
from ajax_filtered_fields.forms import AjaxManyToManyField, ForeignKeyByLetter
|
||||
from django.conf import settings
|
||||
|
||||
ajax_filtered_js = (
|
||||
settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js",
|
||||
settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js",
|
||||
settings.STATIC_URL + 'js/jquery/jquery.js',
|
||||
settings.STATIC_URL + 'js/ajax_filtered_fields.js',
|
||||
)
|
||||
"""
|
||||
class ItemAdminForm(forms.ModelForm):
|
||||
imdb = ForeignKeyByLetter(models.ItemImdb, field_name='title')
|
||||
oxdb = ForeignKeyByLetter(models.ItemOxdb, field_name='title')
|
||||
|
||||
class Meta:
|
||||
model = models.Item
|
||||
|
||||
class Media:
|
||||
js = ajax_filtered_js
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
<link rel="shortcut icon" type="image/png" href="/static/png/icon16.png"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/highlight.css"/>
|
||||
<script type="text/javascript" src="/static/oxjs/build/Ox.js"></script>
|
||||
<script type="text/javascript" src="/static/js/highlight.pack.js"></script>
|
||||
<script type="text/javascript" src="/static/js/pandora.api.js"></script>
|
||||
<script type="text/javascript" src="/static/js/api/highlight.pack.js"></script>
|
||||
<script type="text/javascript" src="/static/js/api/pandora.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<title>{{settings.SITENAME}}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<script type="text/javascript" src="/static/oxjs/build/Ox.js"></script>
|
||||
<script type="text/javascript" src="/static/js/pandoraEmbed.js"></script>
|
||||
<script type="text/javascript" src="/static/js/embed/pandora.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
};
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="/static/oxjs/dev/Ox.js"></script>
|
||||
<script type="text/javascript" src="/static/js/pandora.js"></script>
|
||||
<script type="text/javascript" src="/static/oxjs/build/Ox.js"></script>
|
||||
<script type="text/javascript" src="/static/js/init.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue