Style tweaks

This commit is contained in:
Tom Christie 2012-10-29 14:41:33 +00:00
parent 49f87cfbab
commit ee8ab283f0
3 changed files with 14 additions and 3 deletions

View File

@ -10,8 +10,18 @@ def api_view(http_method_names):
def decorator(func): def decorator(func):
class WrappedAPIView(APIView): WrappedAPIView = type(
pass 'WrappedAPIView',
(APIView,),
{'__doc__': func.__doc__}
)
# Note, the above allows us to set the docstring.
# It is the equivelent of:
#
# class WrappedAPIView(APIView):
# pass
# WrappedAPIView.__doc__ = func.doc <--- Not possible to do this
allowed_methods = set(http_method_names) | set(('options',)) allowed_methods = set(http_method_names) | set(('options',))
WrappedAPIView.http_method_names = [method.lower() for method in allowed_methods] WrappedAPIView.http_method_names = [method.lower() for method in allowed_methods]

View File

@ -59,6 +59,7 @@ pre {
.page-header { .page-header {
border-bottom: none; border-bottom: none;
padding-bottom: 0px; padding-bottom: 0px;
margin-bottom: 20px;
} }

View File

@ -109,7 +109,7 @@
<div class="content-main"> <div class="content-main">
<div class="page-header"><h1>{{ name }}</h1></div> <div class="page-header"><h1>{{ name }}</h1></div>
<p class="resource-description">{{ description }}</p> {{ description }}
<div class="request-info"> <div class="request-info">
<pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre> <pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>