Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added very rough outline of an html view (citizen app).
- Loading branch information
Showing
8 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
from django.conf.urls.defaults import * | ||
|
||
urlpatterns = patterns('', | ||
url(r'^all', 'votersdaily_web.api.views.all', name='api_all'), | ||
) |
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
Empty file.
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,27 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<title>votersdaily_web.citizen.views.all</title> | ||
</head> | ||
<body> | ||
<table> | ||
<tbody> | ||
{% for document in documents %} | ||
<tr> | ||
<td>{{ document.datetime }}</td> | ||
<td>{{ document.title }}</td> | ||
<td>{{ document.description }}</td> | ||
<td>{{ document.end_datetime }}</td> | ||
<td>{{ document.branch }}</td> | ||
<td>{{ document.entity }}</td> | ||
<td>{{ document.source_url }}</td> | ||
<td>{{ document.source_text }}</td> | ||
<td>{{ document.access_datetime }}</td> | ||
<td>{{ document.parser_name }}</td> | ||
<td>{{ document.parser_version }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</body> | ||
</html> |
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,40 @@ | ||
import json | ||
|
||
import couchdb | ||
from couchdb.schema import * | ||
from django.http import HttpResponse, HttpResponseRedirect, Http404 | ||
from django.shortcuts import render_to_response | ||
|
||
from votersdaily_web import settings | ||
|
||
def get_event_db(): | ||
""" | ||
Setup CouchDB. Encapsulated for clarity. | ||
""" | ||
server = couchdb.Server(settings.COUCHDB_SERVER_URI) | ||
event_db = server[settings.COUCHDB_EVENTDB_NAME] | ||
|
||
return event_db | ||
|
||
def all(request): | ||
event_db = get_event_db() | ||
|
||
# JSON | ||
#if request.accepts('application/json'): | ||
# GET | ||
if request.method == 'GET': | ||
#doc_id = '2008-10-06T00:00:00Z - Judicial - Supreme Court - Order List' | ||
#document = event_db[doc_id] | ||
|
||
documents = [] | ||
|
||
for doc_id in event_db: | ||
documents.append(event_db[doc_id]) | ||
|
||
return render_to_response('all.html', { 'documents': documents }) | ||
else: | ||
raise NotImplementedError() | ||
# HTML | ||
#else: | ||
# raise NotImplementedError() | ||
|
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
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 |
---|---|---|
@@ -1,17 +1,9 @@ | ||
from django.conf.urls.defaults import * | ||
|
||
# Uncomment the next two lines to enable the admin: | ||
# from django.contrib import admin | ||
# admin.autodiscover() | ||
|
||
urlpatterns = patterns('', | ||
# Example: | ||
url(r'^all', 'api.views.all', name='all'), | ||
|
||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs' | ||
# to INSTALLED_APPS to enable admin documentation: | ||
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
# (r'^admin/(.*)', admin.site.root), | ||
# API | ||
(r'^api/', include('votersdaily_web.api.urls')), | ||
|
||
# Citizen | ||
url(r'^all', 'votersdaily_web.citizen.views.all', name='all'), | ||
) |