forked from jsocol/django-adminplus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Socol
committed
Mar 4, 2011
1 parent
4198380
commit 5609ec4
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% extends "admin/base_site.html" %} | ||
|
||
{% block breadcrumbs %} | ||
<div class="breadcrumbs"> | ||
<a href="{% url admin:index %}">Home</a> › {{ title }} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
=========================== | ||
Creating Custom Admin Views | ||
=========================== | ||
|
||
Any view can be used as a custom admin view in AdminPlus. All the normal rules | ||
apply: accept a request and possibly other parameters, return a response, and | ||
you're good. | ||
|
||
Making views look like the rest of the admin is pretty straight-forward, too. | ||
|
||
|
||
Extending the Admin Templates | ||
============================= | ||
|
||
AdminPlus contains an base template you can easily extend. It includes the | ||
breadcrumb boilerplate. You can also extend ``admin/base_site.html`` directly. | ||
|
||
Your view should pass a ``title`` value to the template to make things pretty. | ||
|
||
Here's an example template:: | ||
|
||
{# myapp/admin/myview.html #} | ||
{% extends 'adminplus/base.html' %} | ||
|
||
{% block content %} | ||
{# Do what you gotta do. #} | ||
{% endblock %} | ||
|
||
That's pretty much it! Now here's how you use it:: | ||
|
||
# myapp/admin.py | ||
# Using AdminPlus | ||
from django.contrib import admin | ||
from django.shortcuts import render_to_response | ||
from django.template import RequestContext | ||
|
||
def myview(request): | ||
# Fanciness. | ||
return render_to_response('myapp/admin/myview.html', | ||
{'title': 'My View'}, | ||
RequestContext(request, {})) | ||
admin.site.register_view('mypath', myview, 'My View') | ||
|
||
Voila! Instant custom admin page that looks great. |