-
Notifications
You must be signed in to change notification settings - Fork 39
Description
I'm having problem getting this to work. I've used this package elsewhere with no problems. What's different is: 1) I'm using Python 3.7 + Django 2.1; 2) the model in question also subclasses another class that alters the default ModelAdmin - but I don't see how either of these should affect it not finding the modelclone/change_form.html.
It appears that Django is not trying to locate the template within site-packages:
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.7/site-packages/django/contrib/admin/templates/modelclone/change_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.7/site-packages/django/contrib/auth/templates/modelclone/change_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.7/site-packages/django_extensions/templates/modelclone/change_form.html (Source does not exist)
TEMPLATES in the settings.py is:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
and the admin.py's class is:
from django.contrib import admin
import modelclone
from gatekeeper.admin import GatekeeperSerialAdmin
from .models import Homepage
class HomepageAdmin(modelclone.ClonableModelAdmin, GatekeeperSerialAdmin):
model = Homepage
admin.site.register(Homepage, HomepageAdmin)
I could make it work by explicitly adding
'/usr/local/lib/python3.7/site-packages/modelclone/templates' to the DIRS list in TEMPLATES, but that's not a workable solution if the server setup changes.
Actually - that didn't quite work: you can bring up the instance in the Admin and there's a "duplicate" button. When you click it, the duplicate admin comes up but there's no "save" button, just "close".
Any suggestions/ideas or pointing out where I screwed up :-) would be greatly appreciated.