-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Felipe Álvarez
committed
Sep 24, 2015
1 parent
e380184
commit d89789e
Showing
7 changed files
with
163 additions
and
10 deletions.
There are no files selected for viewing
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,16 @@ | ||
from django import forms | ||
from promises_instances.csv_loader import DDAHCSVProcessor | ||
|
||
|
||
class CSVUploadForm(forms.Form): | ||
csv_file = forms.FileField() | ||
|
||
def __init__(self, instance, *args, **kwargs): | ||
self.instance = instance | ||
return super(CSVUploadForm, self).__init__(*args, **kwargs) | ||
|
||
def upload(self): | ||
file_ = self.cleaned_data['csv_file'] | ||
|
||
processor = DDAHCSVProcessor(file_, self.instance) | ||
processor.work() |
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,8 @@ | ||
<form enctype="multipart/form-data" class="uniForm" id="wayfinder_map_form" method="POST" action=""> | ||
|
||
{{form.errors}} | ||
{{ form.non_field_errors }} | ||
|
||
{{form.as_p}} | ||
{% csrf_token %} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
The instance {{instance}} | ||
|
||
<div> | ||
{% for category in instance.categories.all %} | ||
<div> | ||
<h2>{{category.name}}</h2> | ||
{% for promise in category.promises.all %} | ||
<div> | ||
{{promise.name}} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
|
||
</div> |
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,9 +1,11 @@ | ||
from django.conf.urls import patterns, url | ||
from ddah_web.views import DDAHInstanceWebView, DDAHInstanceWebJSONView, FlatPageView | ||
from django.http import HttpResponse | ||
from .views import BackendHomeView | ||
from .views import BackendHomeView, InstanceDetailView, CSVUploadView | ||
|
||
|
||
urlpatterns = patterns('', | ||
url(r'^hola/?$', BackendHomeView.as_view(), name='home'), | ||
url(r'^/?$', BackendHomeView.as_view(), name='home'), | ||
url(r'^detail/(?P<slug>[\w-]+)/?$', InstanceDetailView.as_view(), name='instance'), | ||
url(r'^detail/(?P<slug>[\w-]+)/upload/?$', CSVUploadView.as_view(), name='csv_upload'), | ||
) |
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