django-admin-sortable/sample_project/appmedia/api.py
Brandon Taylor 8365043e0e Modified classmethod queries that determine if a Model is sortable to only retieve one record and not use count.
Fixed jQueryUI highlight method call in success handler of ajax function when dragging stops.
Fixed missing script resource for jquery.effects.core.js
2011-11-16 00:48:14 -06:00

15 lines
No EOL
464 B
Python
Executable file

import os, os.path as osp
from django.conf import settings
from django.db.models import get_apps
def get_app_resource(app, path):
apps = get_apps()
for x in apps:
app_dir = osp.dirname(x.__file__)
if app == x.__name__.split('.')[-2]:
resource_dir = osp.join(app_dir, "resources")
asset = osp.join(resource_dir, path)
if osp.exists(asset):
return asset
continue