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
from django.contrib import admin | |
from models import * | |
admin.site.register(Issue) |
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
from django.db import models | |
# Create your models here. | |
ISSUE_TYPE = ( | |
('Broken Streetlight','Broken Streetlight'), | |
('Pipe Leakage','Pipe Leakage'), | |
('Pot Hole','Pot Hole'), | |
('alien infestation','alien infestation'), | |
('stray dogs','stray dogs'), | |
('runaway velociraptor','runaways velociraptor') |
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
INSTALLED_APPS = ( | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.sites', | |
'django.contrib.admin', | |
'issue' | |
) |
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
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | |
DATABASE_NAME = 'citizenwatch.db' # Or path to database file if using sqlite3. | |
DATABASE_USER = '' # Not used with sqlite3. | |
DATABASE_PASSWORD = '' # Not used with sqlite3. | |
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. | |
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. |
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
<html> | |
<head> | |
<title>{% block title %}{% endblock %}</title> | |
</head> | |
<body> | |
{% block content %}{% endblock %} | |
</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
{% extends 'base.html' %} | |
{% block title %}list issue{% endblock %} | |
{% block content%} | |
{% for i in issue %} | |
<p> | |
<a href="/issue/view/?id={{i.id}}">{{i.title}}</a> vote:{{i.votes}} | |
</p> | |
{% endfor %} | |
{% 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
from django.conf.urls.defaults import * | |
from views import * | |
urlpatterns = patterns('', | |
(r'add/',add_issue), | |
(r'view/',view_issue), | |
(r'list/',list_issue)) |
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
from django.shortcuts import render_to_response | |
from forms import IssueForm | |
from django.http import HttpResponseRedirect | |
from models import * | |
# Create your views here. | |
def add_issue(request): | |
if request.method == 'GET': | |
form = IssueForm() | |
return render_to_response('issue/add.html',{'form':form}) |
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
from django.forms import ModelForm | |
from models import * | |
class IssueForm(ModelForm): | |
class Meta: | |
model = Issue | |
exclude = ('closed','votes') | |
~ |
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
{% extends 'base.html' %} | |
{% block title %}Add Issue{% endblock %} | |
{% block content %} | |
<form method="POST" action="/issue/add/"> | |
{{form.as_p}} | |
<input type="submit" value="report"/> | |
</form> | |
{% endblock %} |