Skip to content

Commit

Permalink
Adding missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
akurtovic committed Jun 15, 2014
1 parent c2a46cd commit a652a9c
Show file tree
Hide file tree
Showing 14 changed files with 1,508 additions and 279 deletions.
16 changes: 10 additions & 6 deletions stlcrime/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
url(r'^index', views.index, name='index'),
url(r'^sixhours.html', views.sixHours, name='sixhours'),
url(r'^twelvehours.html', views.twelveHours, name='twelvehours'),
#url(r'^day.html', views.day, name='day'),
#url(r'^week.html', views.week, name='week'),
#url(r'^month.html', views.month, name='month'),
#url(r'^all.html', views.all, name='all'),
#url(r'^postdispatch.html', views.postDispatch, name='pd'),
#url(r'^sixhours.html', views.sixHours, name='sixhours'),
url(r'^day.html', views.day, name='day'),
url(r'^week.html', views.week, name='week'),
url(r'^month.html', views.month, name='month'),
url(r'^all.html', views.all, name='all'),
url(r'^postdispatch.html', views.PD, name='pd'),
url(r'^ksdk.html', views.KSDK, name='ksdk'),
url(r'^kmov.html', views.KMOV, name='kmov'),
url(r'^rft.html', views.RFT, name='rft'),
url(r'^kmox.html', views.KMOX, name='kmox'),
url(r'^bnd.html', views.BND, name='bnd'),
)
79 changes: 76 additions & 3 deletions storylist/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def index(request):
Main Index View:
Displays all stories crawled in the past week
"""
past_week = datetime.now() - timedelta(days=7)
stories = Story.objects.filter(added__gt=past_week).all()
past24 = datetime.now() - timedelta(days=1)
stories = Story.objects.filter(added__gt=past24).all()
context = Context({
'story_list': reversed(stories)
})
Expand All @@ -32,4 +32,77 @@ def twelveHours(request):
context = Context({
'story_list': reversed(stories)
})
return render(request, '../templates/twelvehours.html', context)
return render(request, '../templates/twelvehours.html', context)

def day(request):
past_day = datetime.now() - timedelta(days=1)
stories = Story.objects.filter(added__gt=past_day).all()
context = Context({
'story_list': reversed(stories)
})
return render(request, '../templates/day.html', context)

def week(request):
past_week = datetime.now() - timedelta(days=7)
stories = Story.objects.filter(added__gt=past_week).all()
context = Context({
'story_list': reversed(stories)
})
return render(request, '../templates/week.html', context)

def month(request):
past_month = datetime.now() - timedelta(days=30)
stories = Story.objects.filter(added__gt=past_month).all()
context = Context({
'story_list': reversed(stories)
})
return render(request, '../templates/month.html', context)

def all(request):
stories = Story.objects.all()
context = Context({
'story_list': reversed(stories)
})
return render(request, '../templates/all.html', context)

def PD(request):
stories = Story.objects.filter(source="Post-Dispatch").all()
context = Context ({
'story_list': reversed(stories)
})
return render(request, '../templates/postdispatch.html', context)

def KSDK(request):
stories = Story.objects.filter(source="KSDK").all()
context = Context ({
'story_list': reversed(stories)
})
return render(request, '../templates/ksdk.html', context)

def KMOV(request):
stories = Story.objects.filter(source="KMOV").all()
context = Context ({
'story_list': reversed(stories)
})
return render(request, '../templates/kmov.html', context)

def RFT(request):
stories = Story.objects.filter(source="Riverfront Times").all()
context = Context ({
'story_list': reversed(stories)
})
return render(request, '../templates/rft.html', context)

def KMOX(request):
stories = Story.objects.filter(source="KMOX").all()
context = Context ({
'story_list': reversed(stories)
})
return render(request, '../templates/kmox.html', context)

def BND(request):
stories = Story.objects.filter(source="Belleville News-Democrat").all()
context = Context ({
'story_list': reversed(stories)
})
return render(request, '../templates/bnd.html', context)
133 changes: 133 additions & 0 deletions templates/all.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
{% load staticfiles %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="{% static "css/bootstrap-theme.min.css" %} ">
<link rel="stylesheet" href="{% static "css/bootstrap.css" %} ">
<style>
body { margin-left: 150px; margin-right: 150px; }
@media (max-width: 980px) {
body { margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 760px) {
body { margin-left: 5px; margin-right: 5px; }
}
</style>

<script src="{% static "js/bootstrap.js" %}"></script>
<script src="{% static "js/jquery.js" %}"></script>

<script type ="text/javascript" src="{% static "js/bootstrap.js" %}"></script>
<script>
$(document).ready(function(){
$('.dropdown-toggle').dropdown()
});
</script>
</head>

<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

<!-- START HEADER -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-6">
<h1 class="title">St. Louis Crimeline</h1>
<p class="lead">A timeline of crime news in St. Louis</p>
</div>
</div>
</div>
<!-- END HEADER -->

<!-- START NAV BAR -->
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs" style="margin-bottom: 5px;">
<li class="active"><a href="#filter" data-toggle="tab">Filter</a></li>
<li><a data-toggle="tab" href="#about">About</a></li>
</ul>

<div id="myTabContent" class="tab-content">
<div class="tab-pane fade" id="about">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">About St. Louis Crimeline</h3>
</div>
<div class="panel-body">
<p>St. Louis Crimeline is like Google News for local crime reporting. It automatically aggregates the latest crime news from local media and displays links to the stories in a responsive, mobile-friendly format.</p>
<p>Crimeline is built with 100% open-source software. The back-end is written in <a href="http://www.python.org">Python.</a> The stories are aggregated using the <a href="http://www.scrapy.org">Scrapy</a> screen scraping and web crawling framework, which feeds items into a <a href="http://www.sqlite.org/">SQLite</a> database and <a href="https://www.djangoproject.com/">Django-powered</a> website. The front-end is handled by Twitter’s <a href="http://getbootstrap.com/">Bootstrap</a> framework.</p>
<p>St. Louis Crimeline is an open-source project. The code that runs this website is available on Github.</p>
</div>
</div>
</div>

<div class="tab-pane fade active in" id="filter">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Filter by Time</h3>
</div>
<div class="panel-body">
<a class="btn btn-primary" href="sixhours.html">6 Hours</a>
<a class="btn btn-primary" href="twelvehours.html">12 Hours</a>
<a class="btn btn-primary" href="day.html">1 Day</a>
<a class="btn btn-primary" href="week.html">1 Week</a>
<a class="btn btn-primary" href="month.html">1 Month</a>
<a class="btn btn-info" href="">All</a>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Filter by Source</h3>
</div>
<div class="panel-body">
<a class="btn btn-primary" href="postdispatch.html">Post-Dispatch</a>
<a class="btn btn-primary" href="ksdk.html">KSDK</a>
<a class="btn btn-primary" href="kmov.html">KMOV</a>
<a class="btn btn-primary" href="rft.html">Riverfront Times</a>
<a class="btn btn-primary" href="kmox.html">KMOX</a>
<a class="btn btn-primary" href="bnd.html">Belleville News-Democrat</a>
</div>
</div>
</div> <!-- END HOME TAB -->
</div>
<!-- END NAV BAR -->


<!-- STORY GRID -->
{% if story_list %}
<ul class="timeline">

{% for story in story_list %}
{% if forloop.counter|divisibleby:'2' %}
<li class="timeline-inverted">
{% else %}
<li class="timeline">
{% endif %}
<div class="timeline-badge"><i class="glyphicon glyphicon-exclamation-sign"></i></div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">{{ story.headline }}</h4>
<p><small class="text-muted"><i class="glyphicon glyphicon-time"></i>{{ story.added}}</small></p>
</div>
<div class="timeline-body">
<h5><a href="{{ story.url }}">{{ story.source }}</a></h5>
</div>
</div>
</li>
{% endfor %}

{% else %}
<p>No stories loaded.</p>
{% endif %}

</body>
</html>
133 changes: 133 additions & 0 deletions templates/bnd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
{% load staticfiles %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="{% static "css/bootstrap-theme.min.css" %} ">
<link rel="stylesheet" href="{% static "css/bootstrap.css" %} ">
<style>
body { margin-left: 150px; margin-right: 150px; }
@media (max-width: 980px) {
body { margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 760px) {
body { margin-left: 5px; margin-right: 5px; }
}
</style>

<script src="{% static "js/bootstrap.js" %}"></script>
<script src="{% static "js/jquery.js" %}"></script>

<script type ="text/javascript" src="{% static "js/bootstrap.js" %}"></script>
<script>
$(document).ready(function(){
$('.dropdown-toggle').dropdown()
});
</script>
</head>

<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

<!-- START HEADER -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-6">
<h1 class="title">St. Louis Crimeline</h1>
<p class="lead">A timeline of crime news in St. Louis</p>
</div>
</div>
</div>
<!-- END HEADER -->

<!-- START NAV BAR -->
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs" style="margin-bottom: 5px;">
<li class="active"><a href="#filter" data-toggle="tab">Filter</a></li>
<li><a data-toggle="tab" href="#about">About</a></li>
</ul>

<div id="myTabContent" class="tab-content">
<div class="tab-pane fade" id="about">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">About St. Louis Crimeline</h3>
</div>
<div class="panel-body">
<p>St. Louis Crimeline is like Google News for local crime reporting. It automatically aggregates the latest crime news from local media and displays links to the stories in a responsive, mobile-friendly format.</p>
<p>Crimeline is built with 100% open-source software. The back-end is written in <a href="http://www.python.org">Python.</a> The stories are aggregated using the <a href="http://www.scrapy.org">Scrapy</a> screen scraping and web crawling framework, which feeds items into a <a href="http://www.sqlite.org/">SQLite</a> database and <a href="https://www.djangoproject.com/">Django-powered</a> website. The front-end is handled by Twitter’s <a href="http://getbootstrap.com/">Bootstrap</a> framework.</p>
<p>St. Louis Crimeline is an open-source project. The code that runs this website is available on Github.</p>
</div>
</div>
</div>

<div class="tab-pane fade active in" id="filter">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Filter by Time</h3>
</div>
<div class="panel-body">
<a class="btn btn-primary" href="sixhours.html">6 Hours</a>
<a class="btn btn-primary" href="twelvehours.html">12 Hours</a>
<a class="btn btn-primary" href="day.html">1 Day</a>
<a class="btn btn-primary" href="week.html">1 Week</a>
<a class="btn btn-primary" href="month.html">1 Month</a>
<a class="btn btn-primary" href="all.html">All</a>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Filter by Source</h3>
</div>
<div class="panel-body">
<a class="btn btn-primary" href="postdispatch.html">Post-Dispatch</a>
<a class="btn btn-primary" href="ksdk.html">KSDK</a>
<a class="btn btn-primary" href="kmov.html">KMOV</a>
<a class="btn btn-primary" href="rft.html">Riverfront Times</a>
<a class="btn btn-primary" href="kmox.html">KMOX</a>
<a class="btn btn-info" href="">Belleville News-Democrat</a>
</div>
</div>
</div> <!-- END HOME TAB -->
</div>
<!-- END NAV BAR -->


<!-- STORY GRID -->
{% if story_list %}
<ul class="timeline">

{% for story in story_list %}
{% if forloop.counter|divisibleby:'2' %}
<li class="timeline-inverted">
{% else %}
<li class="timeline">
{% endif %}
<div class="timeline-badge"><i class="glyphicon glyphicon-exclamation-sign"></i></div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">{{ story.headline }}</h4>
<p><small class="text-muted"><i class="glyphicon glyphicon-time"></i>{{ story.added}}</small></p>
</div>
<div class="timeline-body">
<h5><a href="{{ story.url }}">{{ story.source }}</a></h5>
</div>
</div>
</li>
{% endfor %}

{% else %}
<p>No stories loaded.</p>
{% endif %}

</body>
</html>

0 comments on commit a652a9c

Please sign in to comment.