Surveys Models
Survey
Represents a scheduled site survey linked to a lead. The survey determines whether the customer’s site is ready for charger installation.
Field |
Type |
Constraints |
Description |
|---|---|---|---|
id |
UUIDField |
PK, default=uuid4 |
Primary key |
survey_id |
CharField(20) |
unique, auto-generated |
Human-readable ID (e.g., |
lead |
OneToOneField(Lead) |
not null, on_delete=CASCADE |
Associated lead |
scheduled_date |
DateField |
not null |
Planned survey date |
scheduled_time_slot |
CharField(20) |
choices: |
Time window |
status |
CharField(20) |
choices, default=’scheduled’ |
Survey lifecycle state |
customer_confirmed |
BooleanField |
default=False |
Customer confirmed availability |
created_by |
ForeignKey(User) |
not null, on_delete=PROTECT |
Central Ops who scheduled |
created_at |
DateTimeField |
auto_now_add |
Creation timestamp |
updated_at |
DateTimeField |
auto_now |
Last update |
Status choices: scheduled, confirmed, in_progress, completed, report_submitted, reviewed_approved, reviewed_rejected, rescheduled, cancelled
Indexes: status, scheduled_date, created_by
SurveyAssignment
Links a survey to a field team. Supports both primary assignments and emergency backup reassignments.
Field |
Type |
Constraints |
Description |
|---|---|---|---|
id |
UUIDField |
PK, default=uuid4 |
Primary key |
survey |
ForeignKey(Survey) |
not null, on_delete=CASCADE |
Parent survey |
team |
ForeignKey(Team) |
not null, on_delete=PROTECT |
Assigned field team |
assigned_by |
ForeignKey(User) |
not null, on_delete=PROTECT |
Central Ops who assigned |
is_primary |
BooleanField |
default=True |
Primary assignment vs emergency backup |
assigned_at |
DateTimeField |
auto_now_add |
Assignment timestamp |
status |
CharField(20) |
choices: |
Assignment state |
SurveyReport
Detailed site assessment submitted by the field team after conducting the survey.
Field |
Type |
Constraints |
Description |
|---|---|---|---|
id |
UUIDField |
PK, default=uuid4 |
Primary key |
survey |
OneToOneField(Survey) |
not null, on_delete=CASCADE |
Parent survey |
submitted_by |
ForeignKey(User) |
not null, on_delete=PROTECT |
Field team member who submitted |
site_ready |
BooleanField |
not null |
Overall: is the site installation-ready? |
load_adequate |
BooleanField |
not null |
Electrical load sufficient for charger |
earthing_present |
BooleanField |
not null |
Proper earthing exists at site |
civil_work_needed |
BooleanField |
default=False |
Civil work required before installation |
civil_work_details |
TextField |
blank |
Description of civil work needed |
electrical_notes |
TextField |
blank |
Electrical observations and recommendations |
general_notes |
TextField |
blank |
General site observations |
reviewed_by |
ForeignKey(User) |
nullable, on_delete=SET_NULL |
Central Ops reviewer |
review_status |
CharField(20) |
choices: |
Review outcome |
review_notes |
TextField |
blank |
Reviewer comments |
submitted_at |
DateTimeField |
auto_now_add |
Submission timestamp |
reviewed_at |
DateTimeField |
nullable |
Review timestamp |
SurveyMedia
Photos and videos captured during a survey.
Field |
Type |
Constraints |
Description |
|---|---|---|---|
id |
UUIDField |
PK, default=uuid4 |
Primary key |
survey |
ForeignKey(Survey) |
not null, on_delete=CASCADE |
Parent survey |
media_type |
CharField(20) |
choices: |
Media type |
file |
FileField |
not null, upload_to=’survey_media/’ |
Media file |
caption |
CharField(255) |
blank |
Description of what the media shows |
uploaded_by |
ForeignKey(User) |
not null, on_delete=PROTECT |
Field team member who uploaded |
uploaded_at |
DateTimeField |
auto_now_add |
Upload timestamp |