Skip to content

Commit

Permalink
Merge pull request #2 from Nerdylicious/master
Browse files Browse the repository at this point in the history
Basic Volunteer and Job Functionality
  • Loading branch information
rosariorobinson committed Jul 9, 2014
2 parents 0df8f41 + f6532b1 commit 417d7cd
Show file tree
Hide file tree
Showing 258 changed files with 72,551 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.pyc
*.swk
*.swn
*.swo
*.swp
.vagrant*
21 changes: 21 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider :virtualbox do |vb|
vb.gui=true
end
config.vm.box = "systers-vms-dev"

# config.vm.box_url = "../box/pc-web-05192014-i386.box"
config.vm.box_url = "http://54.183.32.240/vagrant/box/systers-vms.box"

config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 8000, host:8001
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "public_network"

end
Empty file added vms/auth/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions vms/auth/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contrib import admin
from auth.models import UserProfile

# Register your models here.
admin.site.register(UserProfile)
16 changes: 16 additions & 0 deletions vms/auth/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django import forms
from django.contrib.auth.models import User
from auth.models import UserProfile

class UserForm(forms.ModelForm):
#password not visible when user types it out
password = forms.CharField(widget=forms.PasswordInput())

class Meta:
model = User
fields = ('username', 'password')

class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ('website', 'picture')
14 changes: 14 additions & 0 deletions vms/auth/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.contrib.auth.models import User
from django.db import models

class UserProfile(models.Model):
#links UserProfile to a User model instance
user = models.OneToOneField(User)

#additional attributes we wish to include
website = models.URLField(blank=True)
picture = models.ImageField(upload_to='profile_images', blank=True)

#override the unicode method to return out something meaningful
def __unicode__(self):
return self.user.username
12 changes: 12 additions & 0 deletions vms/auth/templates/auth/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "vms/base.html" %}

{% block content %}
<div class="ui icon warning message">
<i class="attention icon"></i>
<div class="content">
<div class="header">
Please log in first!
</div>
</div>
</div>
{% endblock %}
23 changes: 23 additions & 0 deletions vms/auth/templates/auth/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "vms/base.html" %}

{% block content %}
{% if user.is_authenticated %}
<div class="ui icon success message">
<i class="checkmark icon"></i>
<div class="content">
<div class="header">
Welcome {{ user.volunteer.first_name }}! You have successfully logged in!
</div>
</div>
</div>
{% else %}
<div class="ui icon error message">
<i class="attention icon"></i>
<div class="content">
<div class="header">
There was an error logging in!
</div>
</div>
</div>
{% endif %}
{% endblock %}
19 changes: 19 additions & 0 deletions vms/auth/templates/auth/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "vms/base.html" %}

{% block content %}
<h3 class="ui black block header">
Login
</h3>
<form method="post" action="{% url 'auth:user_login' %}">
{% csrf_token %}
<div class="ui form segment">
<div class="field">
<input placeholder="Username" type="text" name="username">
</div>
<div class="field">
<input placeholder="Password" type="password" name="password">
</div>
<button type="submit" class="ui blue button">Login</button>
</div>
</form>
{% endblock %}
205 changes: 205 additions & 0 deletions vms/auth/templates/auth/register.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{% extends "vms/base.html" %}

{% block content %}
{% if registered %}
<h1>Thank you for registering!</h1>
{% else %}
<h3 class="ui black block header">
VMS Registration
</h3>
<form method="post" action="{% url 'auth:register_volunteer' %}" enctype="multipart/form-data">
{% csrf_token %}
<div class="ui form segment">
<div class="field">
<label>Username</label>
<div class="ui input">
<input placeholder="Username" type="text" name="usr-username">
</div>
</div>
<div class="field">
<label>Password</label>
<div class="ui input">
<input placeholder="Password" type="password" name="usr-password">
</div>
</div>
<div class="field">
<label>About</label>
<div class="ui input">
{% if volunteeer_form.description.value %}
<textarea placeholder="Include a short biography about yourself" name="vol-description">{{ volunteeer_form.description.value }}</textarea>
{% else %}
<textarea placeholder="Include a short biography about yourself" name="vol-description"></textarea>
{% endif %}
{% if volunteeer_form.description.errors %}
<div class="ui red pointing above ui label">Enter a valid biography</div>
{% endif %}
</div>
</div>
<div class="two fields">
<div class="field">
<label>First Name</label>
<div class="ui input">
{% if volunteeer_form.first_name.value %}
<input placeholder="First Name" type="text" name="vol-first_name" value="{{ volunteeer_form.first_name.value }}">
{% else %}
<input placeholder="First Name" type="text" name="vol-first_name">
{% endif %}
{% if volunteeer_form.first_name.errors %}
<div class="ui red pointing above ui label">Enter a valid first name</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Last Name</label>
<div class="ui input">
{% if volunteeer_form.last_name.value %}
<input placeholder="Last Name" type="text" name="vol-last_name" value="{{ volunteeer_form.last_name.value }}">
{% else %}
<input placeholder="Last Name" type="text" name="vol-last_name">
{% endif %}
{% if volunteeer_form.last_name.errors %}
<div class="ui red pointing above ui label">Enter a valid last name</div>
{% endif %}
</div>
</div>
</div>
<div class="field">
<label>Address</label>
<div class="ui input">
{% if volunteeer_form.address.value %}
<input placeholder="Address" type="text" name="vol-address" value="{{ volunteeer_form.address.value }}">
{% else %}
<input placeholder="Address" type="text" name="vol-address">
{% endif %}
{% if volunteeer_form.address.errors %}
<div class="ui red pointing above ui label">Enter a valid address</div>
{% endif %}
</div>
</div>
<div class="field">
<label>City</label>
<div class="ui input">
{% if volunteeer_form.city.value %}
<input placeholder="City" type="text" name="vol-city" value="{{ volunteeer_form.city.value }}">
{% else %}
<input placeholder="City" type="text" name="vol-city">
{% endif %}
{% if volunteeer_form.city.errors %}
<div class="ui red pointing above ui label">Enter a valid city</div>
{% endif %}
</div>
</div>
<div class="field">
<label>State/Province</label>
<div class="ui input">
{% if volunteeer_form.state.value %}
<input placeholder="State/Province" type="text" name="vol-state" value="{{ volunteeer_form.state.value }}">
{% else %}
<input placeholder="State/Province" type="text" name="vol-state">
{% endif %}
{% if volunteeer_form.state.errors %}
<div class="ui red pointing above ui label">Enter a valid state/province</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Country</label>
<div class="ui input">
{% if volunteeer_form.country.value %}
<input placeholder="Country" type="text" name="vol-country" value="{{ volunteeer_form.country.value }}">
{% else %}
<input placeholder="Country" type="text" name="vol-country">
{% endif %}
{% if volunteeer_form.country.errors %}
<div class="ui red pointing above ui label">Enter a valid country</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Phone Number</label>
<div class="ui input">
{% if volunteeer_form.phone_number.value %}
<input placeholder="Phone Number" type="text" name="vol-phone_number" value="{{ volunteeer_form.phone_number.value }}">
{% else %}
<input placeholder="Phone Number" type="text" name="vol-phone_number">
{% endif %}
{% if volunteeer_form.phone_number.errors %}
<div class="ui red pointing above ui label">Enter a valid phone number</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Select your organization:</label>
<select name="organization_name">
<option value="0">-- Select Organization --</option>
{% for organization in organization_list %}
<option value="{{ organization.id }}">{{ organization.organization_name }}</option>
{% endfor %}
</select>
</div>
<div class="field">
<label>If your organization is not listed, please provide it here:</label>
<div class="ui input">
{% if volunteeer_form.unlisted_organization.value %}
<input placeholder="Organization" type="text" name="vol-unlisted_organization" value="{{ volunteeer_form.unlisted_organization.value }}">
{% else %}
<input placeholder="Organization" type="text" name="vol-unlisted_organization">
{% endif %}
{% if volunteeer_form.unlisted_organization.errors %}
<div class="ui red pointing above ui label">Enter a valid organization</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Email</label>
<div class="ui input">
{% if volunteeer_form.email.value %}
<input placeholder="Email" type="text" name="vol-email" value="{{ volunteeer_form.email.value }}">
{% else %}
<input placeholder="Email" type="text" name="vol-email">
{% endif %}
{% if volunteeer_form.email.errors %}
<div class="ui red pointing above ui label">Enter a valid email address</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Profiles</label>
<div class="ui input">
{% if volunteeer_form.websites.value %}
<textarea placeholder="Include links to any online profiles here" name="vol-websites">{{ volunteeer_form.websites.value }}</textarea>
{% else %}
<textarea placeholder="Include links to any online profiles here" name="vol-websites"></textarea>
{% endif %}
{% if volunteeer_form.websites.errors %}
<div class="ui red pointing above ui label">Enter valid online profiles</div>
{% endif %}
</div>
</div>
<div class="field">
<label>Upload a Resume</label>
{{ volunteer_form.resume_file }}
{% if volunteeer_form.resume_file.errors %}
<div class="ui red pointing left ui label">Upload a valid resume</div>
{% endif %}
</div>
<div class="field">
<label>Resume</label>
<div class="ui input">
{% if volunteeer_form.resume.value %}
<textarea placeholder="Include your resume here" name="vol-resume">{{ volunteeer_form.resume.value }}</textarea>
{% else %}
<textarea placeholder="Include your resume here" name="vol-resume"></textarea>
{% endif %}
{% if volunteeer_form.resume.errors %}
<div class="ui red pointing above ui label">Enter a valid resume</div>
{% endif %}
</div>
</div>
<button type="submit" class="ui blue button">Register</button>
<button type="reset" class="ui button">Clear</button>
</div>
</form>
{% endif %}
{% endblock %}

3 changes: 3 additions & 0 deletions vms/auth/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
11 changes: 11 additions & 0 deletions vms/auth/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.conf.urls import url
from auth import views

urlpatterns = [
url(r'^register/$', views.register, name='register'),
url(r'^register_volunteer/$', views.register_volunteer, name='register_volunteer'),
url(r'^login/$', views.user_login, name='user_login'),
url(r'^index/$', views.index, name='index'),
url(r'^restricted/', views.restricted, name='restricted'),
url(r'^logout/$', views.user_logout, name='user_logout'),
]
Loading

0 comments on commit 417d7cd

Please sign in to comment.