Last active
March 16, 2019 01:39
-
-
Save darklow/5245430 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# urls.py | |
urlpatterns = patterns('', | |
# Example for custom menu | |
url(r'^admin/custom/$', views.custom_view), | |
# Uncomment the next line to enable the admin: | |
url(r'^admin/', include(admin.site.urls)), | |
) | |
# views.py | |
@staff_member_required | |
def custom_view(request): | |
context = { | |
'title': 'Custom view', | |
} | |
template = 'admin/custom_view.html' | |
return render_to_response(template, context, | |
context_instance=RequestContext(request)) | |
# templates/admin/custom_view.html | |
{% extends "admin/base_site.html" %} | |
{% load i18n %} | |
{% block breadcrumbs %} | |
<ul class="breadcrumb"> | |
<li class="active"> | |
<i class="icon-home"></i> | |
{% trans "Custom view" %} | |
</li> | |
</ul> | |
{% endblock %} | |
{% block content %} | |
<table id="result_list" class="table table-striped table-bordered table-hover table-condensed"> | |
<thead> | |
<tr> | |
<th>Information on example</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td>This is just an example how menu can link to custom view</td> | |
</tr> | |
</tbody> | |
</table> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment