Skip to content
Jayesh Lahori edited this page Aug 15, 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 as division of job,
  6. Admin can assign a SAT entry to volunteer, Email sent to concerned volunteer for his responsibility
  7. Search for jobs by events (To be used by Irish)
  8. Search for jobs by time (To be used by Irish)
  9. Volunteer can log their WLT entries
  10. Volunteer can see SAT's assigned to them
  11. Volunteer can see their WLT's
  12. Generate Reports based on hours contributed by organization
  13. Generate Reports based on hours contributed by organization in an event
  14. Generate Reports based on hours contributed by organization by time
  15. 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 stores shifts, which are like multiple copies of the job differentiated by time. This is what is assigned to Volunteer via SAT entries
```
CREATE TABLE "AdminUnit_shift" (
    "id" integer NOT NULL PRIMARY KEY,
    "event_id" integer NOT NULL REFERENCES "AdminUnit_event" ("id"),
    "job_id" integer NOT NULL REFERENCES "AdminUnit_job" ("id"),
    "location" varchar(128) NOT NULL,
    "how" varchar(128) NOT NULL,
    "startTime" datetime NOT NULL,
    "endTime" datetime NOT NULL,
    UNIQUE ("event_id", "job_id", "startTime", "endTime")
);
```
* **SAT** - This table logs which shift has been assigned to which Volunteer. This does not count for actual hours volunteer has worked for
```
CREATE TABLE "AdminUnit_sat" (
    "id" integer NOT NULL PRIMARY KEY,
    "shift_id" integer NOT NULL REFERENCES "AdminUnit_shift" ("id"),
    "volunteer_id" integer NOT NULL REFERENCES "AdminUnit_volunteerprofile" ("id"),     "startTime" datetime NOT NULL,
    "endTime" datetime NOT NULL, 
    "hours" real NOT NULL, 
    UNIQUE ("shift_id", "volunteer_id")
);
```
* **WLT** - This table actually helps the volunteer to log hours in a Shift. This is the hours for which a volunteer is rewarded for
```
CREATE TABLE "AdminUnit_wlt" (
    "id" integer NOT NULL PRIMARY KEY,
    "shift_id" integer NOT NULL REFERENCES "AdminUnit_shift" ("id"),
    "volunteer_id" integer NOT NULL REFERENCES "AdminUnit_volunteerprofile" ("id"),
    "startTime" datetime NOT NULL,
    "endTime" datetime NOT NULL,
    "hours" real NOT NULL,
    UNIQUE ("shift_id", "volunteer_id")
);
```
Clone this wiki locally