On 3/10/06, pbx <[EMAIL PROTECTED]> wrote:
>
> I came across a subtle gotcha with template overriding in magic-removal
> today. It stems from these two facts:
>
> 1. loaders stop at the first match
> 2. the admin is now just another app in INSTALLED_APPS
>
> The resulting gotcha: to override admin templates your app must appear
> *before* django.contrib.admin in INSTALLED_APPS.
>

Maybe I was wrong. But I think it's no. You can review the admin code,
I found that:

def render_change_form(model, manipulator, context, add=False,
change=False, form_url=''):
    opts = model._meta
    app_label = opts.app_label
    auto_populated_fields = [f for f in opts.fields if f.prepopulate_from]
    field_sets = opts.admin.get_field_sets(opts)
    original = getattr(manipulator, 'original_object', None)
    bound_field_sets = [field_set.bind(context['form'], original,
AdminBoundFieldSet) for field_set in field_sets]
    first_form_field_id =
bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id();
    ordered_objects = opts.get_ordered_objects()
    inline_related_objects =
opts.get_followed_related_objects(manipulator.follow)
    extra_context = {
        'add': add,
        'change': change,
        'has_delete_permission':
context['perms'][app_label][opts.get_delete_permission()],
        'has_file_field': opts.has_field_type(models.FileField),
        'has_absolute_url': hasattr(model, 'get_absolute_url'),
        'auto_populated_fields': auto_populated_fields,
        'bound_field_sets': bound_field_sets,
        'first_form_field_id': first_form_field_id,
        'javascript_imports': get_javascript_imports(opts,
auto_populated_fields, field_sets),
        'ordered_objects': ordered_objects,
        'inline_related_objects': inline_related_objects,
        'form_url': form_url,
        'opts': opts,
        'content_type_id': ContentType.objects.get_for_model(model).id,
    }
    context.update(extra_context)
    return render_to_response([
        "admin/%s/%s/change_form" % (app_label, opts.object_name.lower()),
        "admin/%s/change_form" % app_label,
        "admin/change_form"], context_instance=context)

So you can see, there are several ways to customize admin template,
fullly according to your template directory. So if you want to custom
admin template, you can create template directory according to above
code, and set the root directory in TEMPLATE_DIRS , and the order I
think it's not very important.



--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to