mirror of
https://github.com/jazzband/django-admin-sortable.git
synced 2026-03-17 06:20:33 +00:00
Refactored how the sortable_by properties get populated by looping over the model fields until we get to the SortableForeignKey, then grabbing properties from the field and its related data.
15 lines
No EOL
464 B
Python
15 lines
No EOL
464 B
Python
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 |