-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first round of work toward #21, implementing survey
- Loading branch information
1 parent
28abe91
commit 06536d7
Showing
18 changed files
with
221 additions
and
0 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 |
---|---|---|
|
@@ -72,6 +72,7 @@ | |
'accounts', | ||
'mdi', | ||
'maps', | ||
'surveys', | ||
'lockdown', | ||
] | ||
|
||
|
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,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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.apps import AppConfig | ||
|
||
|
||
class SurveysConfig(AppConfig): | ||
name = 'surveys' |
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,56 @@ | ||
from django.forms import ModelForm, TextInput, Textarea, RadioSelect, DateTimeInput | ||
from django.utils.translation import gettext_lazy as _ | ||
from accounts.models import User | ||
from mdi.models import Organization | ||
|
||
|
||
class UserForm(ModelForm): | ||
class Meta: | ||
model = User | ||
fields = [ | ||
'first_name', | ||
'middle_name', | ||
'last_name', | ||
'email', | ||
'role' | ||
] | ||
labels = { | ||
'role': _('Are you a…'), | ||
} | ||
widgets = { | ||
# 'role': RadioSelect() | ||
} | ||
|
||
|
||
class OrganizationForm(ModelForm): | ||
class Meta: | ||
model = Organization | ||
fields = [ | ||
'name', | ||
'url', | ||
'email', | ||
'socialnetworks', | ||
'address', | ||
'city', | ||
'state', | ||
'postal_code', | ||
'country', | ||
'founded', | ||
] | ||
labels = { | ||
'name': _('What is the name of your enterprise or project?'), | ||
'url': _('What is the URL of your enterprise or project?'), | ||
'email': _('What is the general contact email address for your enterprise or project?'), | ||
'socialnetworks': _('What are the social media handles of your enterprise or project?'), | ||
'state': _('State or province'), | ||
'founded': _('When was your enterprise or project founded?') | ||
} | ||
help_texts = { | ||
} | ||
widgets = { | ||
'url': TextInput(attrs={'placeholder': 'e.g., https://example.coop/'}), | ||
'founded': DateTimeInput(format="%d/%m/%Y", attrs={'placeholder':"DD/MM/YY"}) | ||
} | ||
|
||
|
||
|
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,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
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,25 @@ | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html class="no-js"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title> | ||
{% block title %}{{ title }}{% endblock %} | ||
</title> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/> | ||
<script src="{% static 'maps/scripts/pinecone.umd.js' %}"></script> | ||
<link href="{% static 'maps/styles/pinecone.css' %}" rel="stylesheet"> | ||
<link rel="shortcut icon" href="{% static 'maps/images/favicon.png' %}" type="image/x-icon"> | ||
</head> | ||
<body class="home page"> | ||
{% include 'surveys/header.html' %} | ||
<div class="wrap container" role="document"> | ||
<div class="content"> | ||
<main> | ||
{% block content %}{% endblock %} | ||
</main> | ||
</div> | ||
</div> | ||
{% include 'maps/footer.html' %} | ||
</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,9 @@ | ||
<header role="banner"> | ||
<div class="container"> | ||
<a class="link link--brand" aria-current="page" href="{% url 'index' %}"> | ||
{% include './svg/pcc.svg' %} | ||
<span class="brand__title screen-reader-text">Platform Cooperatives Worldwide</span></a> | ||
<div class="inner"> | ||
</div> | ||
</div> | ||
</header> |
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,61 @@ | ||
{% extends 'surveys/base.html' %} | ||
{% load static %} | ||
{% load i18n %} | ||
{% load maps_extras %} | ||
{% block title %}{{ '2020 Ecosystem Survey'|titlify }}{% endblock %} | ||
{% block content %} | ||
<div class="page-header"> | ||
<h1><span class="pc-ff--sans pc-fw--normal">Platform Co-op</span><br/> Directory</h1> | ||
<p class="subhead">2020 Survey of the International Cooperative Digital Ecosystem</p> | ||
</div> | ||
<h3>Do you need funding for your cooperative digital project?</h3> | ||
<p>No matter at which stage of development, potential funders, the International Cooperative Alliance, and supportive policymakers need to know that you exist!!</p> | ||
|
||
<p>Whether your project just launched or is already fully operational and growing, prospective supporters need to understand the significance of your project!</p> | ||
|
||
<p>They need to grasp that you matter. FOR THAT, THEY NEED DATA!</p> | ||
|
||
<p>We need to provide funders and all supporters with reliable information about your project!! Without it, you may be dismissed and remain invisible.</p> | ||
|
||
<p><strong>Please help us to help you.</strong></p> | ||
|
||
<p>The survey has been prepared by Prof. Trebor Scholz and Angela Difede at The New School’s Institute for the Cooperative Digital Economy. Please feel free to contact us directly with any questions.</p> | ||
|
||
<p>WE WILL ADD THE INFORMATION THAT YOU PROVIDE HERE TO A *PUBLIC INDEX* ON HTTP://PLATFORM.COOP</p> | ||
|
||
<p> | ||
Our email:<br /> | ||
[email protected] | ||
</p> | ||
<p> | ||
Mail:<br /> | ||
Institute for the Cooperative Digital Economy<br /> | ||
The New School<br /> | ||
79 5th Avenue, Room 1601<br /> | ||
New York, NY, 10003<br /> | ||
USA | ||
</p> | ||
|
||
<div class="spacer"></div> | ||
<form action="#" method="post"> | ||
{% csrf_token %} | ||
<fieldset> | ||
<legend><strong>Your contact information</strong></legend> | ||
<p>Please provide the contact information for the best person to reach out to should we have follow-up questions about the answers you have provided to the short form of our survey. This contact information will not be part of the index. It will not be published online.</p> | ||
<div class="spacer"></div> | ||
{{ user_form }} | ||
</fieldset> | ||
|
||
<div class="spacer"></div> | ||
<fieldset> | ||
<legend><strong>About your enterprise or project</strong></legend> | ||
{{ organization_form }} | ||
</fieldset> | ||
|
||
<div class="spacer"></div> | ||
<button id="button" type="submit" class="button"> | ||
<span class="button__label">{% trans "Submit" %}</span> | ||
</button> | ||
</form> | ||
|
||
{% endblock %} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,7 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
|
||
urlpatterns = [ | ||
path('', views.index, name='index'), | ||
] |
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,24 @@ | ||
from django.http import HttpResponse, HttpResponseRedirect | ||
from django.template import loader | ||
from django.shortcuts import get_object_or_404, render | ||
|
||
from .forms import UserForm, OrganizationForm | ||
|
||
from accounts.models import User | ||
from mdi.models import Organization, Category, Sector, Type | ||
|
||
|
||
def index(request): | ||
if request.method == 'POST': | ||
form = UserForm(request.POST) | ||
if form.is_valid(): | ||
return HttpResponseRedirect('/thanks/') | ||
|
||
else: | ||
user_form = UserForm() | ||
organization_form = OrganizationForm() | ||
|
||
return render(request, 'surveys/index.html', { | ||
'user_form': user_form, | ||
'organization_form': organization_form, | ||
}) |