Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created csv upload #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions hackathon_starter/hackathon/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email', 'password')

class UploadFileForm(forms.Form):
file = forms.FileField()
103 changes: 57 additions & 46 deletions hackathon_starter/hackathon/templates/hackathon/base.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,72 @@
<!DOCTYPE html>
{% load staticfiles %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

{% load bootstrap3 %}

{% bootstrap_css %}
{% bootstrap_javascript %}
<html lang="en">
<head>
<head>
<title> Django Hackathon Starter </title>
<script src="/static/bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="/static/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/bower_components/d3/d3.min.js"></script>

<link rel="stylesheet" href="/static/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/static/bower_components/bootstrap-social/bootstrap-social.css">
<link rel="stylesheet" href="/static/bower_components/font-awesome/css/font-awesome.min.css">

</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
</head>

<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Django Hackathon Starter</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
{% if user.is_authenticated %}
<li><a href="/hackathon/api">API</a></li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if not user.is_authenticated %}
<li class="active"><a href="/hackathon/register">Register <span class="sr-only">(current)</span></a></li>

<li><a href="/hackathon/login">Login</a></li>
{% endif %}

</ul>

<ul class="nav navbar-nav navbar-right">
{% if user.is_authenticated %}

<li><a>Hello {{user}}</a></li>
<li><a href="/hackathon/logout/">Logout</a></li>
{% endif %}
</ul>


</li>
</ul>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Django Hackathon Starter</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
{% if user.is_authenticated %}
<li><a href="{% url 'api' %}">API</a></li>
<li><a href="{% url 'upload_file' %}">Upload CSV</a></li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if not user.is_authenticated %}
<li class="active"><a href="/hackathon/register">Register <span class="sr-only">(current)</span></a>
</li>
<li><a href="{% url 'upload_file' %}">Upload CSV</a></li>

<li><a href="/hackathon/login">Login</a></li>
{% endif %}

</ul>

<ul class="nav navbar-nav navbar-right">
{% if user.is_authenticated %}

<li><a>Hello {{user}}</a></li>
<li><a href="/hackathon/logout/">Logout</a></li>
{% endif %}
</ul>


</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</body>
</div><!-- /.container-fluid -->
</nav>
</body>
</html>
28 changes: 0 additions & 28 deletions hackathon_starter/hackathon/templates/hackathon/login.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,6 @@ <h2 class="form-signin-heading">Login</h2>
</div>

<div class="form-signin">
<a class="btn btn-block btn-social btn-twitter" href="http://127.0.0.1:8000/hackathon/twitter_login/">
<i class="fa fa-twitter"></i>
Sign in with Twitter
</a>
<a class="btn btn-block btn-social btn-instagram" href="http://localhost:8000/hackathon/instagram_login/">
<i class="fa fa-instagram"></i>
Sign in with Instagram
</a>
<a class="btn btn-block btn-social btn-tumblr" href="http://localhost:8000/hackathon/tumblr_login/">
<i class="fa fa-tumblr"></i>
Sign in with Tumblr
</a>
<a class="btn btn-block btn-social btn-github" href="http://localhost:8000/hackathon/github_login/">
<i class="fa fa-github"></i>
Sign in with Github
</a>
<a class="btn btn-block btn-social btn-linkedin" href="http://localhost:8000/hackathon/linkedin_login/">
<i class="fa fa-linkedin"></i>
Sign in with LinkedIn
</a>
<a class="btn btn-block btn-social btn-facebook" href="http://localhost:8000/hackathon/facebook_login/">
<i class="fa fa-facebook"></i>
Sign in with Facebook
Expand All @@ -54,14 +34,6 @@ <h2 class="form-signin-heading">Login</h2>
<i class="fa fa-google"></i>
Sign in with Google+
</a>
<a class="btn btn-block btn-social btn-dropbox" href="http://localhost:8000/hackathon/dropbox_login/">
<i class="fa fa-dropbox"></i>
Sign in with Dropbox
</a>
<a class="btn btn-block btn-social btn-foursquare" href="http://localhost:8000/hackathon/foursquare_login/">
<i class="fa fa-foursquare"></i>
Sign in with Foursquare
</a>
</div>
</body>
</html>
27 changes: 27 additions & 0 deletions hackathon_starter/hackathon/templates/hackathon/upload_csv.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
form {
width: 50%;
margin: auto;
text-align: center;
}
</style>
</head>
<body>
{% include 'hackathon/base.html' %}

{% load static %}

{% block content %}
<form method="post" enctype="multipart/form-data" action="{% url 'csv_reader' %}">
{% csrf_token %}
{{ form }}
<input style="margin-left: auto; margin-right: auto" type="submit" value="Upload">
</form>
{% endblock %}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>

.photo-request{
width:75%;
margin:auto;
text-align:left;
}
</style>
</head>
<body>
{% include 'hackathon/base.html' %}

{% load static %}

{% block content %}
{% for r in requests %}
<div class="photo-request">
{% for key, value in r.items %}
<p><b>{{key}}: </b>{{ value }}</p>
{% endfor %}
</div>
<hr>
{% endfor %}
{% endblock %}
</body>
</html>
105 changes: 54 additions & 51 deletions hackathon_starter/hackathon/urls.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@
from django.conf.urls import patterns, url, include
from rest_framework.routers import DefaultRouter

from hackathon import views
import views

router = DefaultRouter()
router.register(r'snippets', views.SnippetView)

urlpatterns = patterns('',
url(r'^', include(router.urls)),
url(r'^register/$', views.register, name='register'),
url(r'^login/$', views.user_login, name='login'),
url(r'^logout/$', views.user_logout, name='logout'),
url(r'^api/$', views.api_examples, name='api'),
url(r'^steam/$', views.steam, name='steam'),
url(r'^steamDiscountedGames/$', views.steamDiscountedGames, name='steamDiscountedGames'),
url(r'^githubResume/$', views.githubResume, name='githubResume'),
url(r'^githubUser/$', views.githubUser, name='githubUser'),
url(r'^githubTopRepositories/$', views.githubTopRepositories, name='githubTopRepositories'),
url(r'^tumblr/$', views.tumblr, name='tumblr'),
url(r'^linkedin/$', views.linkedin, name='linkedin'),
url(r'^twilio/$', views.twilio, name='twilio'),
url(r'^instagram/$', views.instagram, name='instagram'),
url(r'^instagram_login/$', views.instagram_login, name='instagram_login'),
url(r'^instagramUser/$', views.instagramUser, name='instagramUser'),
url(r'^instagramMediaByLocation/$', views.instagramMediaByLocation, name='instagramMediaByLocation'),#
url(r'^instagramUserMedia/$', views.instagramUserMedia, name='instagramUserMedia'),
url(r'^twitter/$', views.twitter, name='twitter'),
url(r'^twitterTweets/$', views.twitterTweets, name='twitterTweets'),
url(r'^tumblr_login/$', views.tumblr_login, name='tumblr_login'),
url(r'^twitter_login/$', views.twitter_login, name='twitter_login'),
url(r'^github_login/$', views.github_login, name='github_login'),
url(r'^linkedin_login/$', views.linkedin_login, name='linkedin_login'),
url(r'^facebook_login/$', views.facebook_login, name='facebook_login'),
url(r'^facebook/$', views.facebook, name='facebook'),
url(r'^google_login/$', views.google_login, name='google_login'),
url(r'^google/$', views.googlePlus, name='googlePlus'),
url(r'^dropbox_login/$', views.dropbox_login, name='dropbox_login'),
url(r'^dropbox/$', views.dropbox, name='dropbox'),
url(r'^dropboxSearchFile/$', views.dropboxSearchFile, name='dropboxSearchFile'),
url(r'^foursquare_login/$', views.foursquare_login, name='foursquare_login'),
url(r'^foursquare/$', views.foursquare, name='foursquare'),
url(r'^quandlSnp500/$', views.quandlSnp500, name='quandlsnp500'),
url(r'^quandlNasdaq/$', views.quandlNasdaq, name='quandlnasdaq'),
url(r'^quandlNasdaqdiff/$', views.quandlNasdaqdiff, name='quandlnasdaqdiff'),
url(r'^quandlDowJones/$', views.quandlDowJones, name='quandldowjones'),
url(r'^quandlstocks/$', views.quandlstocks, name='quandlstocks'),
url(r'^quandlapple/$', views.quandlapple, name='quandlapple'),
url(r'^quandlapplediff/$', views.quandlapplediff, name='quandlapplediff'),
url(r'^quandlDowJonesdiff/$', views.quandlDowJonesdiff, name='quandldowjonesdiff'),
url(r'^quandlSnp500diff/$', views.quandlSnp500diff, name='quandlsnp500diff'),
url(r'^nytimespop/$', views.nytimespop, name='nytimespop'),
url(r'^nytimestop/$', views.nytimestop, name='nytimestop'),
url(r'^nytimesarticles/$', views.nytimesarticles, name='nytimesarticles'),
url(r'^meetup/$', views.meetup, name='meetup'),
url(r'^meetupToken/$', views.meetupToken, name='meetupToken'),
url(r'^meetupUser/$', views.meetupUser, name='meetupUser'),
url(r'^yelp/$', views.yelp, name='yelp'),
)
url(r'^', include(router.urls)),
url(r'^register/$', views.register, name='register'),
url(r'^login/$', views.user_login, name='login'),
url(r'^logout/$', views.user_logout, name='logout'),
url(r'^api/$', views.api_examples, name='api'),
url(r'^steam/$', views.steam, name='steam'),
url(r'^steamDiscountedGames/$', views.steamDiscountedGames, name='steamDiscountedGames'),
url(r'^githubResume/$', views.githubResume, name='githubResume'),
url(r'^githubUser/$', views.githubUser, name='githubUser'),
url(r'^githubTopRepositories/$', views.githubTopRepositories, name='githubTopRepositories'),
url(r'^tumblr/$', views.tumblr, name='tumblr'),
url(r'^linkedin/$', views.linkedin, name='linkedin'),
url(r'^twilio/$', views.twilio, name='twilio'),
url(r'^instagram/$', views.instagram, name='instagram'),
url(r'^instagram_login/$', views.instagram_login, name='instagram_login'),
url(r'^instagramUser/$', views.instagramUser, name='instagramUser'),
url(r'^instagramMediaByLocation/$', views.instagramMediaByLocation,
name='instagramMediaByLocation'), #
url(r'^instagramUserMedia/$', views.instagramUserMedia, name='instagramUserMedia'),
url(r'^twitter/$', views.twitter, name='twitter'),
url(r'^twitterTweets/$', views.twitterTweets, name='twitterTweets'),
url(r'^tumblr_login/$', views.tumblr_login, name='tumblr_login'),
url(r'^twitter_login/$', views.twitter_login, name='twitter_login'),
url(r'^github_login/$', views.github_login, name='github_login'),
url(r'^linkedin_login/$', views.linkedin_login, name='linkedin_login'),
url(r'^facebook_login/$', views.facebook_login, name='facebook_login'),
url(r'^facebook/$', views.facebook, name='facebook'),
url(r'^google_login/$', views.google_login, name='google_login'),
url(r'^google/$', views.googlePlus, name='googlePlus'),
url(r'^dropbox_login/$', views.dropbox_login, name='dropbox_login'),
url(r'^dropbox/$', views.dropbox, name='dropbox'),
url(r'^dropboxSearchFile/$', views.dropboxSearchFile, name='dropboxSearchFile'),
url(r'^foursquare_login/$', views.foursquare_login, name='foursquare_login'),
url(r'^foursquare/$', views.foursquare, name='foursquare'),
url(r'^quandlSnp500/$', views.quandlSnp500, name='quandlsnp500'),
url(r'^quandlNasdaq/$', views.quandlNasdaq, name='quandlnasdaq'),
url(r'^quandlNasdaqdiff/$', views.quandlNasdaqdiff, name='quandlnasdaqdiff'),
url(r'^quandlDowJones/$', views.quandlDowJones, name='quandldowjones'),
url(r'^quandlstocks/$', views.quandlstocks, name='quandlstocks'),
url(r'^quandlapple/$', views.quandlapple, name='quandlapple'),
url(r'^quandlapplediff/$', views.quandlapplediff, name='quandlapplediff'),
url(r'^quandlDowJonesdiff/$', views.quandlDowJonesdiff, name='quandldowjonesdiff'),
url(r'^quandlSnp500diff/$', views.quandlSnp500diff, name='quandlsnp500diff'),
url(r'^nytimespop/$', views.nytimespop, name='nytimespop'),
url(r'^nytimestop/$', views.nytimestop, name='nytimestop'),
url(r'^nytimesarticles/$', views.nytimesarticles, name='nytimesarticles'),
url(r'^meetup/$', views.meetup, name='meetup'),
url(r'^meetupToken/$', views.meetupToken, name='meetupToken'),
url(r'^meetupUser/$', views.meetupUser, name='meetupUser'),
url(r'^yelp/$', views.yelp, name='yelp'),
url(r'^upload_file/$', views.upload_file, name='upload_file'),
url(r'^read_csv/?filename=', views.csv_reader, name='csv_reader'),
)
Loading