From dd39d6a77fe0a97b45f0505ce87323682cf6f2fa Mon Sep 17 00:00:00 2001 From: Jayesh Lahori Date: Sun, 22 Jun 2014 18:24:36 +0530 Subject: [PATCH] Admin Functionality --- AdminUnit/.DS_Store | Bin 0 -> 6148 bytes AdminUnit/AdminUnit/.DS_Store | Bin 0 -> 6148 bytes AdminUnit/AdminUnit/__init__.py | 0 AdminUnit/AdminUnit/admin.py | 7 + AdminUnit/AdminUnit/forms.py | 88 ++++++++++ AdminUnit/AdminUnit/models.py | 47 ++++++ AdminUnit/AdminUnit/tests.py | 3 + AdminUnit/AdminUnit/urls.py | 17 ++ AdminUnit/AdminUnit/views.py | 157 ++++++++++++++++++ AdminUnit/VMS/__init__.py | 0 AdminUnit/VMS/populate.py | 60 +++++++ AdminUnit/VMS/settings.py | 90 ++++++++++ .../AdminUnit/all_assigned_jobs.html | 40 +++++ .../VMS/templates/AdminUnit/all_events.html | 42 +++++ .../VMS/templates/AdminUnit/assign_jobs.html | 57 +++++++ AdminUnit/VMS/templates/AdminUnit/event.html | 57 +++++++ AdminUnit/VMS/templates/AdminUnit/index.html | 23 +++ AdminUnit/VMS/templates/AdminUnit/login.html | 21 +++ .../VMS/templates/AdminUnit/register.html | 90 ++++++++++ .../AdminUnit/registration_form.html | 90 ++++++++++ AdminUnit/VMS/urls.py | 13 ++ AdminUnit/VMS/wsgi.py | 14 ++ AdminUnit/manage.py | 10 ++ 23 files changed, 926 insertions(+) create mode 100644 AdminUnit/.DS_Store create mode 100644 AdminUnit/AdminUnit/.DS_Store create mode 100644 AdminUnit/AdminUnit/__init__.py create mode 100644 AdminUnit/AdminUnit/admin.py create mode 100644 AdminUnit/AdminUnit/forms.py create mode 100644 AdminUnit/AdminUnit/models.py create mode 100644 AdminUnit/AdminUnit/tests.py create mode 100644 AdminUnit/AdminUnit/urls.py create mode 100644 AdminUnit/AdminUnit/views.py create mode 100644 AdminUnit/VMS/__init__.py create mode 100644 AdminUnit/VMS/populate.py create mode 100644 AdminUnit/VMS/settings.py create mode 100644 AdminUnit/VMS/templates/AdminUnit/all_assigned_jobs.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/all_events.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/assign_jobs.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/event.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/index.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/login.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/register.html create mode 100644 AdminUnit/VMS/templates/AdminUnit/registration_form.html create mode 100644 AdminUnit/VMS/urls.py create mode 100644 AdminUnit/VMS/wsgi.py create mode 100755 AdminUnit/manage.py diff --git a/AdminUnit/.DS_Store b/AdminUnit/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4294275c3d7d07a911daf223ac81a6941c6ee8a5 GIT binary patch literal 6148 zcmeHKU279T6upzAx?@0BD5!7qW*?kBMhKEGDTBeGw^h;m(=4bI&YuW|-L_BGwxv9U`BIJh;LdM{$Cwe&tJ6 zvyl}b(_`fHlyXX`+|HJ=UEqIIK&>68JCx9CtlJ;!Ctt>yjM1yM#(nr2oXut^Ph`a7 zVrUsZ<6)K-WxIXEYW2p-x$_?9P2RkCsrft{$Z=Rk<*4XIhtE{&QB)3MTYn;Dc3h9* zowPsR_gC-Ayo}Pkf2hf6(nrePZki`@+>@g`DfU7W+)a~mpa-=9&*L87_peMQopwuX zZcJNZ(z$tKqa|*2y3?uug?rbocW*z4<=c1fKYaZ3`Rg}5J!06-+AdrC4c}3@0I_0P zr-BYBQ=6Uo)ZNbJ1p9%!wV5_e<&Zamyb--Z_Bsve%{+rWUSQN|haOV6kae_>r3ZI~ zQ@|lk0?bYg))S2_ip0`m&gP19HR z|GmGz|K~}r+61rgAW6@&rT)bhCZ#g0w+s6z`-10ibb0b-7r36up|4Zj4Z(e3cQfxwT;1Cu~%V;whTdh$Y3+73|;nJa27e{ zJ2<|CqcWymGb3b)*FjFg)ih`S%XW_FCWt@4inHD^qUbw_PU_L&Xdv&QI_CsyzOx)} z?W5^D2K{%#_>jSfMpXvhs_jt$?%85V-=UVOfGVI0Y!#68A*Bmu9!rOI>0n`x0K}Nh z)>xOH1<6T0W*$q2d_prWmFQB9KVle{&i2&DWgbh1E*-`nK8$BJ{)A#IJNr*s4LKMw*%S#&v&2y>q&a23aA4AN&yp(u17;o$?vU=$;n=u((mYE5?4C3DJ=YU gY%8)AAJeVzSt=D`=CO3h7MlJDSQ)fX1@@}IFI2m>T>t<8 literal 0 HcmV?d00001 diff --git a/AdminUnit/AdminUnit/__init__.py b/AdminUnit/AdminUnit/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/AdminUnit/AdminUnit/admin.py b/AdminUnit/AdminUnit/admin.py new file mode 100644 index 000000000..2901d3e91 --- /dev/null +++ b/AdminUnit/AdminUnit/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from AdminUnit.models import UserProfile, Event, AssignedJob +from django.contrib.auth.models import User + +admin.site.register(UserProfile) +admin.site.register(Event) +admin.site.register(AssignedJob) diff --git a/AdminUnit/AdminUnit/forms.py b/AdminUnit/AdminUnit/forms.py new file mode 100644 index 000000000..07d73a2a3 --- /dev/null +++ b/AdminUnit/AdminUnit/forms.py @@ -0,0 +1,88 @@ +from django import forms +from django.contrib.auth.models import User +from .models import UserProfile, Event, AssignedJob +from django.forms import ModelForm + +class UserForm(forms.Form): + ''' + As per the models, Registering a user involves two forms, user from auth models and custom-defines userprofile. This class is associated with forms for user table + from auth. + ''' + firstname = forms.CharField(required=True) + lastname = forms.CharField(required=True) + username = forms.CharField(required=True) + email = forms.EmailField(required=True) + password = forms.CharField(widget=forms.PasswordInput,required=True) + password2 = forms.CharField(widget=forms.PasswordInput, label="Confirm password", required=True) + + # Check if both passwords are same + def clean_password2(self): + password = self.cleaned_data['password'] + password2 = self.cleaned_data['password2'] + if password != password2: + raise forms.ValidationError("Passwords do not match.") + return password2 + + # Check if this username is not already existing + def clean_username(self): + username = self.cleaned_data['username'] + try: + User.objects.get(username=username) + except User.DoesNotExist: + return username + raise forms.ValidationError('Username "%s" is already in use.' % username) + + +class UserProfileForm(forms.Form): + ''' + As per the models, Registering a user involves two forms, user from auth models and custom-defined userProfile. This class is associated with forms for userProfile + table. + ''' + address = forms.CharField(required=True) + location = forms.CharField(required=True) + state = forms.CharField(required=True) + organization = forms.CharField(required=True) + phone = forms.CharField(required=True) + + # Check if both passwords are same + def clean_phone(self): + phone = self.cleaned_data['phone'] + if len(phone)!=10: + raise forms.ValidationError("Invalid phone number.") + for i in range(10): + if phone[i].isalpha(): + raise forms.ValidationError("Invalid phone number.") + return phone + + +class EventForm(ModelForm): + ''' + Class Responsible for displaying forms of Event Class, inheriting ModelForm Class. + ''' + class Meta: + model = Event + + # To ensure noOfVolunteersRequired > 0 + def clean_noOfVolunteersRequired(self): + noOfVolunteersRequired = self.cleaned_data['noOfVolunteersRequired'] + print noOfVolunteersRequired + if noOfVolunteersRequired <= 0: + raise forms.ValidationError("Please input atleast one volunteer") + return noOfVolunteersRequired + + # Check if this username is not already existing + def clean_eventName(self): + eventName = self.cleaned_data['eventName'] + try: + Event.objects.get(eventName=eventName) + except Event.DoesNotExist: + return username + raise forms.ValidationError('Event Name "%s" is already in use.' % eventName) + + +class AssignJobsForm(ModelForm): + ''' + Class Responsible for displaying forms of AssignedJob Class, inheriting ModelForm Class. + ''' + class Meta: + model = AssignedJob diff --git a/AdminUnit/AdminUnit/models.py b/AdminUnit/AdminUnit/models.py new file mode 100644 index 000000000..8bc895145 --- /dev/null +++ b/AdminUnit/AdminUnit/models.py @@ -0,0 +1,47 @@ +from django.db import models +from django.contrib.auth.models import User +from django.db.models import ForeignKey +from django import forms +import datetime + +class UserProfile(models.Model): + ''' + Model for UserProfile, each record is a one-to-one mapping ro user model from auth and also contains few other parameters + ''' + user = models.OneToOneField(User) + + address = models.CharField(max_length=128) + location = models.CharField(max_length=128) + state = models.CharField(max_length=128) + organization = models.CharField(max_length=128) + phone = models.CharField(max_length=128) + + def __unicode__(self): + return self.user.username + + +class Event(models.Model): + ''' + Model structure of Event Table + ''' + eventName = models.CharField(max_length=128) + noOfVolunteersRequired = models.IntegerField() + startDate = models.DateTimeField() + endDate = models.DateTimeField() + + def __unicode__(self): + return self.eventName + + +class AssignedJob(models.Model): + ''' + Model structure for Jobs, each job has a many-to-one relationship with events, i.e., there can be 'n' number of jobs associated with one single event. 'event' is + therefore a foreign key + ''' + event = models.ForeignKey(Event) + + volunteerName = models.CharField(max_length=128) + job = models.CharField(max_length=128) + + def __unicode__(self): + return self.event.eventName diff --git a/AdminUnit/AdminUnit/tests.py b/AdminUnit/AdminUnit/tests.py new file mode 100644 index 000000000..7ce503c2d --- /dev/null +++ b/AdminUnit/AdminUnit/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/AdminUnit/AdminUnit/urls.py b/AdminUnit/AdminUnit/urls.py new file mode 100644 index 000000000..de0a11966 --- /dev/null +++ b/AdminUnit/AdminUnit/urls.py @@ -0,0 +1,17 @@ +from django.conf.urls import patterns, url +from AdminUnit import views + +urlpatterns = patterns('', + url(r'^$', views.index), + url(r'^register/$', views.register), + url(r'^event/$', views.editEvent), + url(r'^event/(?P\d+)/$', views.editEvent), + url(r'^deleteEvent/(?P\d+)/$', views.deleteEvent), + url(r'^allEvents/$', views.allEvents), + url(r'^assignJob/$', views.assignJob), + url(r'^assignJob/(?P\d+)/$', views.assignJob), + url(r'^allAssignedJobs/$', views.allAssignedJobs), + url(r'^deleteJob/(?P\d+)/$', views.deleteJob), + url(r'^login/$', views.login_process), + url(r'^logout/$', views.logout_process), + ) diff --git a/AdminUnit/AdminUnit/views.py b/AdminUnit/AdminUnit/views.py new file mode 100644 index 000000000..40e05b060 --- /dev/null +++ b/AdminUnit/AdminUnit/views.py @@ -0,0 +1,157 @@ +from django.template import RequestContext +from django.contrib import auth +from django.contrib.auth.models import User +from django.contrib.auth import authenticate, login, logout +from django.contrib.auth.decorators import login_required +from django.http import HttpResponseRedirect, HttpResponse +from django.shortcuts import render, render_to_response + +from .forms import UserForm, UserProfileForm, EventForm, AssignJobsForm +from .models import UserProfile, Event, AssignedJob + +def index(request): + ''' + Controller for VMS Homepage + ''' + return render(request,"AdminUnit/index.html") + +def register(request): + ''' + This method is used to register new user into the system as a volunteer + ''' + + # POST Request, submitted form has come as a request + if request.method == 'POST': + userForm = UserForm(request.POST) + userProfileForm = UserProfileForm(request.POST) + + if userForm.is_valid() and userProfileForm.is_valid(): + user = User.objects.create_user(first_name=userForm.cleaned_data['firstname'],last_name=userForm.cleaned_data['lastname'], + email=userForm.cleaned_data['email'],username=userForm.cleaned_data['username'], + password=userForm.cleaned_data['password']) + + userProfile = UserProfile(user=user, address=userProfileForm.cleaned_data['address'],location=userProfileForm.cleaned_data['location'], + state=userProfileForm.cleaned_data['state'],organization=userProfileForm.cleaned_data['organization'], + phone=userProfileForm.cleaned_data['phone']) + + userProfile.save() + return HttpResponse("You have registered, login available @ AdminUnit/") + + # GET Request, render empty form + else: + userForm = UserForm() + userProfileForm = UserProfileForm() + + return render(request, "AdminUnit/register.html",{ "userForm" : userForm , "userProfileForm" : userProfileForm }) + +def login_process(request): + ''' + Authenticate a user against their credentials + ''' + + # POST Request, submitted form has come as a request, authenticate and redirect to apt page + if request.method == 'POST': + username = request.POST['username'] + password = request.POST['password'] + + user = authenticate(username=username, password=password) + + if user: + if user.is_active: + login(request,user) + return HttpResponse("You are logged in, logout available @ AdminUnit/") + else: + return HttpResponse("Your account is disabled.") + else: + return HttpResponse("Invalid login details supplied.") + + # GET Request, display login form template + else: + return render(request,'AdminUnit/login.html') + +@login_required +def logout_process(request): + ''' + logout a user + ''' + logout(request) + return HttpResponseRedirect('/AdminUnit/') + +@login_required +def editEvent(request, eventId=None): + ''' + Use to Edit/Create Event, In case of Creating new event eventId is None and therefore eventInstance + ''' + if eventId: + eventInstance = Event.objects.get(pk=eventId) + else: + eventInstance = None + + # POST Request, submitted form has come as a request. If eventInstance is none implies new record has to be saved else edited record + if request.method == 'POST': + eventForm = EventForm(request.POST,instance = eventInstance) + if eventForm.is_valid(): + newRecord = eventForm.save() + return HttpResponse("Event Created/Edited") + + # to handle a GET Request + else: + eventForm = EventForm(instance=eventInstance) + + return render(request, "AdminUnit/event.html",{"eventForm" : eventForm}) + +@login_required +def assignJob(request,jobId=None): + ''' + Controller to Edit/Create Jobs. In case of Creating new job, jobId is None and therefore jobInstance + ''' + if jobId: + jobInstance = AssignedJob.objects.get(pk=jobId) + else: + jobInstance = None + + # POST Request, submitted form has come as a request. If jobInstance is none implies new record has to be saved else edited record + if request.method == 'POST': + assignJobsForm = AssignJobsForm(request.POST, instance = jobInstance) + if assignJobsForm.is_valid(): + newRecord = assignJobsForm.save(); + return HttpResponse('Job Assigned') + else: + assignJobsForm = AssignJobsForm(instance = jobInstance) + + return render(request, "AdminUnit/assign_jobs.html",{"assignJobsForm" : assignJobsForm}) + +@login_required +def allEvents(request): + ''' + Controller responsible for displaying all Events that have been registered, alongside will be displayed the links to edit/delete an event + ''' + allEvents = Event.objects.all() + return render(request, "AdminUnit/all_events.html", {"allEvents" : allEvents}); + +@login_required +def allAssignedJobs(request): + ''' + Controller responsible for displaying jobs registered across all Events that have been registered, alongside will be displayed the links to edit/delete the same + ''' + allAssignedJobs = AssignedJob.objects.all() + return render(request, "AdminUnit/all_assigned_jobs.html", {"allAssignedJobs" : allAssignedJobs}); + +@login_required +def deleteEvent(request,eventId=None): + ''' + Delete's an event with a given primary key + ''' + Event.objects.filter(pk=eventId).delete() + allEvents = Event.objects.all() + return render(request, "AdminUnit/all_events.html", {"allEvents" : allEvents}); + +@login_required +def deleteJob(request,jobId=None): + ''' + Delete's a job with a given primary key + ''' + AssignedJob.objects.filter(pk=jobId).delete() + allAssignedJobs = AssignedJob.objects.all() + return render(request, "AdminUnit/all_assigned_jobs.html", {"allAssignedJobs" : allAssignedJobs}); + diff --git a/AdminUnit/VMS/__init__.py b/AdminUnit/VMS/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/AdminUnit/VMS/populate.py b/AdminUnit/VMS/populate.py new file mode 100644 index 000000000..3dd9f9394 --- /dev/null +++ b/AdminUnit/VMS/populate.py @@ -0,0 +1,60 @@ +import os + +def populate(): + python_cat = add_cat('Python') + + add_page(cat=python_cat, + title="Official Python Tutorial", + url="http://docs.python.org/2/tutorial/") + + add_page(cat=python_cat, + title="How to Think like a Computer Scientist", + url="http://www.greenteapress.com/thinkpython/") + + add_page(cat=python_cat, + title="Learn Python in 10 Minutes", + url="http://www.korokithakis.net/tutorials/python/") + + django_cat = add_cat("Django") + + add_page(cat=django_cat, + title="Official Django Tutorial", + url="https://docs.djangoproject.com/en/1.5/intro/tutorial01/") + + add_page(cat=django_cat, + title="Django Rocks", + url="http://www.djangorocks.com/") + + add_page(cat=django_cat, + title="How to Tango with Django", + url="http://www.tangowithdjango.com/") + + frame_cat = add_cat("Other Frameworks") + + add_page(cat=frame_cat, + title="Bottle", + url="http://bottlepy.org/docs/dev/") + + add_page(cat=frame_cat, + title="Flask", + url="http://flask.pocoo.org") + + # Print out what we have added to the user. + for c in Category.objects.all(): + for p in Page.objects.filter(category=c): + print "- {0} - {1}".format(str(c), str(p)) + +def add_page(cat, title, url, views=0): + p = Page.objects.get_or_create(category=cat, title=title, url=url, views=views)[0] + return p + +def add_cat(name): + c = Category.objects.get_or_create(name=name)[0] + return c + +# Start execution here! +if __name__ == '__main__': + print "Starting AdminUnit population script..." + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VMS.settings') + from AdminUnit.models import Category, Page + populate() diff --git a/AdminUnit/VMS/settings.py b/AdminUnit/VMS/settings.py new file mode 100644 index 000000000..fb5535b42 --- /dev/null +++ b/AdminUnit/VMS/settings.py @@ -0,0 +1,90 @@ +""" +Django settings for VMS project. + +For more information on this file, see +https://docs.djangoproject.com/en/1.6/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.6/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '*!1l!$(h^&@%!rgj6vqgk*kd^ioiy6=hf39791fxu8wklgwcgq' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +TEMPLATE_DEBUG = True + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + '/Users/jlahori/personal/VMS/VMS/templates', +) + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'AdminUnit' +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) + +ROOT_URLCONF = 'VMS.urls' + +WSGI_APPLICATION = 'VMS.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.6/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + +# Internationalization +# https://docs.djangoproject.com/en/1.6/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.6/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/AdminUnit/VMS/templates/AdminUnit/all_assigned_jobs.html b/AdminUnit/VMS/templates/AdminUnit/all_assigned_jobs.html new file mode 100644 index 000000000..1c0961c4e --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/all_assigned_jobs.html @@ -0,0 +1,40 @@ + + + + + + + + +
+
+

VMS: Lists of All Assigned Jobs

+
+
+ + + + + + + + + + {% for assigned in allAssignedJobs %} + + + + + + + + {% endfor %} +
Event Name Volunteers Name Job Name Edit Delete
{{ assigned.event.eventName }} {{ assigned.volunteerName }} {{ assigned.job }} Edit Delete
+
+
+ + diff --git a/AdminUnit/VMS/templates/AdminUnit/all_events.html b/AdminUnit/VMS/templates/AdminUnit/all_events.html new file mode 100644 index 000000000..08071293c --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/all_events.html @@ -0,0 +1,42 @@ + + + + + + + + +
+
+

VMS: Lists of Events

+
+
+ + + + + + + + + + + {% for event in allEvents %} + + + + + + + + + {% endfor %} +
Event Name Volunteers Required Start Date End Date Edit Delete
{{ event.eventName }} {{ event.noOfVolunteersRequired }} {{ event.startDate }} {{ event.endDate }} Edit Delete
+
+
+ + diff --git a/AdminUnit/VMS/templates/AdminUnit/assign_jobs.html b/AdminUnit/VMS/templates/AdminUnit/assign_jobs.html new file mode 100644 index 000000000..3e916b27a --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/assign_jobs.html @@ -0,0 +1,57 @@ + + + + + + + +
+
+

VMS: Assign Job

+
+
+
+ {% csrf_token %} + + + {% if AssignJobsForm.non_field_errors %} +

+ {% for error in assignJobsForm.non_field_errors %} + {{ error }} + {% endfor %} +

+ {% endif %} + + {% for field in assignJobsForm %} +
+ + {{ field.label_tag }} + + {% if field.field.required %} + * + {% endif %} +
+ + {{ field }} + + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }} + {% endfor %} +

+ {% endif %} +
+ {% endfor %} + + +
+
+
+ + + diff --git a/AdminUnit/VMS/templates/AdminUnit/event.html b/AdminUnit/VMS/templates/AdminUnit/event.html new file mode 100644 index 000000000..3f62734ce --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/event.html @@ -0,0 +1,57 @@ + + + + + + + +
+
+

VMS: Create Event

+
+
+
+ {% csrf_token %} + + + {% if EventForm.non_field_errors %} +

+ {% for error in eventForm.non_field_errors %} + {{ error }} + {% endfor %} +

+ {% endif %} + + {% for field in eventForm %} +
+ + {{ field.label_tag }} + + {% if field.field.required %} + * + {% endif %} +
+ + {{ field }} + + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }} + {% endfor %} +

+ {% endif %} +
+ {% endfor %} + + +
+
+
+ + + diff --git a/AdminUnit/VMS/templates/AdminUnit/index.html b/AdminUnit/VMS/templates/AdminUnit/index.html new file mode 100644 index 000000000..08da1762a --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/index.html @@ -0,0 +1,23 @@ + + + + + VMS + + + +

VMS Homepage

+ Register Here
+ {% if user.is_authenticated %} + Create Event
+ All Events
+ Assign Job
+ All Assigned Jobs
+ Logout + {% else %} + Login
+ {% endif %} + + + + diff --git a/AdminUnit/VMS/templates/AdminUnit/login.html b/AdminUnit/VMS/templates/AdminUnit/login.html new file mode 100644 index 000000000..55a9e502a --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/login.html @@ -0,0 +1,21 @@ + + + + VMS + + + +

Login to VMS

+ +
+ {% csrf_token %} + Username: +
+ Password: +
+ + +
+ + + diff --git a/AdminUnit/VMS/templates/AdminUnit/register.html b/AdminUnit/VMS/templates/AdminUnit/register.html new file mode 100644 index 000000000..03193d7c3 --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/register.html @@ -0,0 +1,90 @@ + + + + + + + +
+
+

VMS: Register User

+
+
+
+ {% csrf_token %} + + + {% if UserForm.non_field_errors %} +

+ {% for error in userForm.non_field_errors %} + {{ error }} + {% endfor %} +

+ {% endif %} + + {% for field in userForm %} +
+ + {{ field.label_tag }} + + {% if field.field.required %} + * + {% endif %} +
+ + {{ field }} + + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }} + {% endfor %} +

+ {% endif %} +
+ {% endfor %} + + {% if UserProfileForm.non_field_errors %} +

+ {% for error in userProfileForm.non_field_errors %} + {{ error }} + {% endfor %} +

+ {% endif %} + + {% for field in userProfileForm %} +
+ + {{ field.label_tag }} + + {% if field.field.required %} + * + {% endif %} +
+ + {{ field }} + + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }} + {% endfor %} +

+ {% endif %} +
+ {% endfor %} + + + +
+
+
+ + + diff --git a/AdminUnit/VMS/templates/AdminUnit/registration_form.html b/AdminUnit/VMS/templates/AdminUnit/registration_form.html new file mode 100644 index 000000000..03193d7c3 --- /dev/null +++ b/AdminUnit/VMS/templates/AdminUnit/registration_form.html @@ -0,0 +1,90 @@ + + + + + + + +
+
+

VMS: Register User

+
+
+
+ {% csrf_token %} + + + {% if UserForm.non_field_errors %} +

+ {% for error in userForm.non_field_errors %} + {{ error }} + {% endfor %} +

+ {% endif %} + + {% for field in userForm %} +
+ + {{ field.label_tag }} + + {% if field.field.required %} + * + {% endif %} +
+ + {{ field }} + + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }} + {% endfor %} +

+ {% endif %} +
+ {% endfor %} + + {% if UserProfileForm.non_field_errors %} +

+ {% for error in userProfileForm.non_field_errors %} + {{ error }} + {% endfor %} +

+ {% endif %} + + {% for field in userProfileForm %} +
+ + {{ field.label_tag }} + + {% if field.field.required %} + * + {% endif %} +
+ + {{ field }} + + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }} + {% endfor %} +

+ {% endif %} +
+ {% endfor %} + + + +
+
+
+ + + diff --git a/AdminUnit/VMS/urls.py b/AdminUnit/VMS/urls.py new file mode 100644 index 000000000..4885066f8 --- /dev/null +++ b/AdminUnit/VMS/urls.py @@ -0,0 +1,13 @@ +from django.conf.urls import patterns, include, url + +from django.contrib import admin +admin.autodiscover() + +urlpatterns = patterns('', + # Examples: + # url(r'^$', 'VMS.views.home', name='home'), + # url(r'^blog/', include('blog.urls')), + + url(r'^admin/', include(admin.site.urls)), + url(r'^AdminUnit/', include('AdminUnit.urls')) +) diff --git a/AdminUnit/VMS/wsgi.py b/AdminUnit/VMS/wsgi.py new file mode 100644 index 000000000..2b428efd9 --- /dev/null +++ b/AdminUnit/VMS/wsgi.py @@ -0,0 +1,14 @@ +""" +WSGI config for VMS project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ +""" + +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VMS.settings") + +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() diff --git a/AdminUnit/manage.py b/AdminUnit/manage.py new file mode 100755 index 000000000..502d37ffa --- /dev/null +++ b/AdminUnit/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VMS.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv)