Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
9c8ca51c
Commit
9c8ca51c
authored
Feb 14, 2012
by
Paul Oswald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete robots.txt, favicon.ico views; Move style to a new static namespace
parent
ba1e3b46
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
6 additions
and
41 deletions
+6
-41
AUTHORS
+1
-0
djangorestframework/static/djangorestframework/css/style.css
+0
-0
djangorestframework/static/favicon.ico
+0
-0
djangorestframework/static/robots.txt
+0
-2
djangorestframework/templates/api_login.html
+1
-1
djangorestframework/templates/renderer.html
+1
-1
djangorestframework/tests/views.py
+0
-14
djangorestframework/urls.py
+0
-10
djangorestframework/utils/staticviews.py
+0
-9
docs/howto/setup.rst
+3
-4
No files found.
AUTHORS
View file @
9c8ca51c
...
...
@@ -30,6 +30,7 @@ Chris Pickett <bunchesofdonald>
Ben Timby <btimby>
Michele Lazzeri <michelelazzeri-nextage>
Camille Harang <mammique>
Paul Oswald <poswald>
THANKS TO:
...
...
djangorestframework/static/
css/djangorestframework
.css
→
djangorestframework/static/
djangorestframework/css/style
.css
View file @
9c8ca51c
File moved
djangorestframework/static/favicon.ico
deleted
100644 → 0
View file @
ba1e3b46
File deleted
djangorestframework/static/robots.txt
deleted
100644 → 0
View file @
ba1e3b46
User-agent: *
Disallow: /
djangorestframework/templates/api_login.html
View file @
9c8ca51c
...
...
@@ -2,7 +2,7 @@
<html>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{% get_static_prefix %}
css/djangorestframework
.css'
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{% get_static_prefix %}
djangorestframework/css/style
.css'
/>
</head>
<body
class=
"login"
>
...
...
djangorestframework/templates/renderer.html
View file @
9c8ca51c
...
...
@@ -6,7 +6,7 @@
{% load static %}
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{% get_static_prefix %}
css/djangorestframework
.css'
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{% get_static_prefix %}
djangorestframework/css/style
.css'
/>
<title>
Django REST framework - {{ name }}
</title>
</head>
<body>
...
...
djangorestframework/tests/views.py
View file @
9c8ca51c
...
...
@@ -46,8 +46,6 @@ class MockResource(ModelResource):
fields
=
(
'foo'
,
'bar'
,
'baz'
)
urlpatterns
=
patterns
(
'djangorestframework.utils.staticviews'
,
url
(
r'^robots.txt$'
,
'deny_robots'
),
url
(
r'^favicon.ico$'
,
'favicon'
),
url
(
r'^accounts/login$'
,
'api_login'
),
url
(
r'^accounts/logout$'
,
'api_logout'
),
url
(
r'^mock/$'
,
MockView
.
as_view
()),
...
...
@@ -123,18 +121,6 @@ class ExtraViewsTests(TestCase):
"""Test the extra views djangorestframework provides"""
urls
=
'djangorestframework.tests.views'
def
test_robots_view
(
self
):
"""Ensure the robots view exists"""
response
=
self
.
client
.
get
(
'/robots.txt'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
def
test_favicon_view
(
self
):
"""Ensure the favicon view exists"""
response
=
self
.
client
.
get
(
'/favicon.ico'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'image/vnd.microsoft.icon'
)
def
test_login_view
(
self
):
"""Ensure the login view exists"""
response
=
self
.
client
.
get
(
'/accounts/login'
)
...
...
djangorestframework/urls.py
View file @
9c8ca51c
from
django.conf.urls.defaults
import
patterns
from
django.conf
import
settings
urlpatterns
=
patterns
(
'djangorestframework.utils.staticviews'
,
(
r'robots.txt'
,
'deny_robots'
),
(
r'^accounts/login/$'
,
'api_login'
),
(
r'^accounts/logout/$'
,
'api_logout'
),
)
# Only serve favicon in production because otherwise chrome users will pretty much
# permanantly have the django-rest-framework favicon whenever they navigate to
# 127.0.0.1:8000 or whatever, which gets annoying
if
not
settings
.
DEBUG
:
urlpatterns
+=
patterns
(
'djangorestframework.utils.staticviews'
,
(
r'favicon.ico'
,
'favicon'
),
)
djangorestframework/utils/staticviews.py
View file @
9c8ca51c
...
...
@@ -6,15 +6,6 @@ from django.template import RequestContext
import
base64
def
deny_robots
(
request
):
return
HttpResponse
(
'User-agent: *
\n
Disallow: /'
,
mimetype
=
'text/plain'
)
def
favicon
(
request
):
data
=
'AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADLy8tLy8vL3svLy1QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAy8vLBsvLywkAAAAATkZFS1xUVPqhn57/y8vL0gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJmVlQ/GxcXiy8vL88vLy4FdVlXzTkZF/2RdXP/Ly8vty8vLtMvLy5DLy8vty8vLxgAAAAAAAAAAAAAAAAAAAABORkUJTkZF4lNMS/+Lh4f/cWtq/05GRf9ORkX/Vk9O/3JtbP+Ef3//Vk9O/2ljYv/Ly8v5y8vLCQAAAAAAAAAAAAAAAE5GRQlORkX2TkZF/05GRf9ORkX/TkZF/05GRf9ORkX/TkZF/05GRf9ORkX/UEl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GAAIBDgADAA4AAwAOAAMADgADAB4AA/H+AAP7/gAA='
return
HttpResponse
(
base64
.
b64decode
(
data
),
mimetype
=
'image/vnd.microsoft.icon'
)
# BLERGH
# Replicate django.contrib.auth.views.login simply so we don't have get users to update TEMPLATE_CONTEXT_PROCESSORS
# to add ADMIN_MEDIA_PREFIX to the RequestContext. I don't like this but really really want users to not have to
...
...
docs/howto/setup.rst
View file @
9c8ca51c
...
...
@@ -37,16 +37,15 @@ The Python `markdown library <http://www.freewisdom.org/projects/python-markdown
If markdown is installed your :class:`.Resource` descriptions can include `markdown style formatting
<http://daringfireball.net/projects/markdown/syntax>`_ which will be rendered by the HTML documenting renderer.
robots.txt, favicon,
login/logout
login/logout
---------------------------------
Django REST framework comes with a few views that can be useful including a deny robots view, a favicon view, and api login and logout views::
Django REST framework comes with a few views that can be useful including an api
login and logout views::
from django.conf.urls.defaults import patterns
urlpatterns = patterns('djangorestframework.views',
(r'robots.txt', 'deny_robots'),
(r'favicon.ico', 'favicon'),
# Add your resources here
(r'^accounts/login/$', 'api_login'),
(r'^accounts/logout/$', 'api_logout'),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment