Skip to content
Jayesh Lahori edited this page Aug 13, 2014 · 14 revisions

I have Django Project called VMS and AdminUnit as an app inside VMS. Old versions of Requirement Docs, Timeline, Schema can be found at Link

Current Timeline

Features

  1. User's can register themselves as volunteers
  2. Admin can register other admin's
  3. Admin can create Events
  4. Admin can create Jobs inside events, Email sent to all volunteers for new jobs created
  5. Admin can create shifts to assign jobs to volunteers, Email sent to concerned volunteer for his responsibility
  6. Search for jobs by events (To be used by Irish)
  7. Search for jobs by time (To be used by Irish)
  8. Generate Reports based on hours contributed by organization
  9. Generate Reports based on hours contributed by organization in an event
  10. Generate Reports based on hours contributed by organization by time
  11. Generate Reports based on hours contributed by volunteer's inside an organization

File Structure

Following are the file's inside AdminUnit app.

  • models.py - Contains all tables associated with the app
  • forms.py - Contains forms which have been used throughout to enter data into the system. Some of them inherit the ModelForm class of Django which helps directly create a form from Django Models, Other's inherit forms.Form class
  • admin.py - Contains views to be shown in admin
  • tests.py - Contains unit-tests to test the model structures and Client tests to test the views.
  • urls.py - Contains mapping of url's to view methods
  • views.py - Contains methods for displaying views

Model structure

Following are the models currently used in AdminUnit.

  • Organization - This table stores the information about various organization's which are registered ABI. Volunteers/Admins also have an associated organization field in their Profile.
CREATE TABLE "AdminUnit_organization" (
    "id" serial NOT NULL PRIMARY KEY,
    "name" varchar(128) NOT NULL UNIQUE,
    "location" varchar(128) NOT NULL,
    "noOfVolunteers" integer NOT NULL
);
```
* **AdminProfile** - All users who will be given admin access to the system will be registered into this table. This table has a One-to-one relationship with Django's `auth` table.
```
CREATE TABLE "AdminUnit_adminprofile" (
    "id" serial NOT NULL PRIMARY KEY,
    "user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED,
    "address" varchar(128) NOT NULL,
    "location" varchar(128) NOT NULL,
    "state" varchar(128) NOT NULL,
    "organization_id" integer NOT NULL REFERENCES "AdminUnit_organization" ("id") DEFERRABLE INITIALLY DEFERRED,
    "phone" varchar(128) NOT NULL
);
```
* **VolunteerProfile** - All volunteers will be registered in this table. This table will also have one-to-one relationship with `auth` table. **Note** : This model will be replaced by Irish's volunteer model while integration. Currently, its structure is same as AdminProfile.
```
CREATE TABLE "AdminUnit_volunteerprofile" (
    "id" serial NOT NULL PRIMARY KEY,
    "user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED,
    "address" varchar(128) NOT NULL,
    "location" varchar(128) NOT NULL,
    "state" varchar(128) NOT NULL,
    "organization_id" integer NOT NULL REFERENCES "AdminUnit_organization" ("id") DEFERRABLE INITIALLY DEFERRED,
    "phone" varchar(128) NOT NULL
);
```
* **Event** - This table holds information regarding various events which will be created by admins. Eg: GSOC-2014 is an event extending from April-14 to Aug-14.
```
CREATE TABLE "AdminUnit_event" (
    "id" serial NOT NULL PRIMARY KEY,
    "eventName" varchar(128) NOT NULL UNIQUE,
    "noOfVolunteersRequired" integer NOT NULL,
    "startDate" timestamp with time zone NOT NULL,
    "endDate" timestamp with time zone NOT NULL
);
```
* **Job** - This table holds information regarding various jobs which will be created inside an event. Eg: Mentoring is a job inside GSOC-2014 event similar is Org-admin. Since jobs are under event, Job model has a foreign key to `Event` model
```
CREATE TABLE "AdminUnit_job" (
    "id" serial NOT NULL PRIMARY KEY,
    "event_id" integer NOT NULL REFERENCES "AdminUnit_event" ("id") DEFERRABLE INITIALLY DEFERRED,
    "jobName" varchar(128) NOT NULL,
    "jobDescription" varchar(256) NOT NULL,
    "startDate" timestamp with time zone NOT NULL,
    "endDate" timestamp with time zone NOT NULL,
    "noOfVolunteersRequired" integer NOT NULL,
    UNIQUE ("event_id", "jobName")
);
```
* **Shift** - This table acts like a store to store data points of the form `<event, job, volunteer, hours>` . Whenever an admin assigns a job to a volunteer or a volunteer opts for a job, The entry gets created here
```
CREATE TABLE "AdminUnit_shift" (
    "id" serial NOT NULL PRIMARY KEY,
    "event_id" integer NOT NULL REFERENCES "AdminUnit_event" ("id") DEFERRABLE INITIALLY DEFERRED,
    "volunteer_id" integer NOT NULL REFERENCES "AdminUnit_volunteerprofile" ("id") DEFERRABLE INITIALLY DEFERRED,
    "job_id" integer NOT NULL REFERENCES "AdminUnit_job" ("id") DEFERRABLE INITIALLY DEFERRED,
    "hours" integer NOT NULL,
    UNIQUE ("event_id", "volunteer_id", "job_id")
);
```
Clone this wiki locally