diff --git a/back/backend/policy.py b/back/backend/policy.py index 1628b57..723a76b 100644 --- a/back/backend/policy.py +++ b/back/backend/policy.py @@ -39,7 +39,7 @@ general_section = Section( title="General Info", html_description="", fields={ - "destination": {"label": "Destination City", "field_type": "string"}, + "destination": {"number": 0, "label": "Destination City", "field_type": "string"}, } ) @@ -57,12 +57,12 @@ flight_section = Section( title="Flight Info", html_description="
Enter flight details here.
", fields={ - "international": {"label": "Is this an international flight?", "field_type": "boolean"}, - "departure_date": {"label": "Departure date", "field_type": "date"}, - "return_date": {"label": "Return date", "field_type": "date"}, - "fare": {"label": "Fare", "field_type": "decimal"}, - "layovers": {"label": "Transit wait", "field_type": "integer"}, - "fare_search_screenshot": {"label": "Screenshot of fare search", "field_type": "file"}, + "international": {"number": 0, "label": "Is this an international flight?", "field_type": "boolean"}, + "departure_date": {"number": 1, "label": "Departure date", "field_type": "date"}, + "return_date": {"number": 2, "label": "Return date", "field_type": "date"}, + "fare": {"number": 3, "label": "Fare", "field_type": "decimal"}, + "layovers": {"number": 4, "label": "Transit wait", "field_type": "integer"}, + "fare_search_screenshot": {"number": 5, "label": "Screenshot of fare search", "field_type": "file"}, } ) @@ -79,12 +79,12 @@ pol.add_section(flight_section) lodging_section = Section( title="Hotel Info", html_description="Enter hotel info here.\nPer diem rates can be found at " - "this link
", + "this link", fields={ - "check-in_date": {"label": "Check-in date", "field_type": "date"}, - "check-out_date": {"label": "Check-out date", "field_type": "date"}, - "rate": {"label": "Per diem nightly rate", "field_type": "decimal"}, - "cost": {"label": "Total Cost", "field_type": "decimal"} + "check-in_date": {"number": 0, "label": "Check-in date", "field_type": "date"}, + "check-out_date": {"number": 1, "label": "Check-out date", "field_type": "date"}, + "rate": {"number": 2, "label": "Per diem nightly rate", "field_type": "decimal"}, + "cost": {"number": 3, "label": "Total Cost", "field_type": "decimal"} } ) @@ -108,8 +108,8 @@ transport_section = Section( title="Local Transportation", html_description="How much did you spend on local transportation, in total?
", fields={ - "duration": {"label": "How many days was your trip?", "field_type": "integer"}, - "cost": {"label": "Total cost", "field_type": "decimal"} + "duration": {"number":0, "label": "How many days was your trip?", "field_type": "integer"}, + "cost": {"number":1, "label": "Total cost", "field_type": "decimal"} } ) @@ -126,11 +126,11 @@ pol.add_section(transport_section) per_diem_section = Section( title="Per Diem", html_description="Enter info about meals and incidentals here.\nPer diem rates can be found at " - "this link
", + "this link", fields={ - "duration": {"label": "How many days was your trip?", "field_type": "integer"}, - "rate": {"label": "What is the per diem rate for your destination?", "field_type": "decimal"}, - "cost": {"label": "Total Cost for meals and incidentals", "field_type": "decimal"} + "duration": {"number":0, "label": "How many days was your trip?", "field_type": "integer"}, + "rate": {"number":1, "label": "What is the per diem rate for your destination?", "field_type": "decimal"}, + "cost": {"number":2,"label": "Total Cost for meals and incidentals", "field_type": "decimal"} } ) diff --git a/back/backend/views.py b/back/backend/views.py index c615a9e..8331b9f 100644 --- a/back/backend/views.py +++ b/back/backend/views.py @@ -116,13 +116,11 @@ def report(request): s.save() # Create the fields - j = 0 for key in section.fields: field = section.fields[key] f = Field.objects.create(section_id=s, field_name=key, label=field['label'], - number=j, field_type=field['field_type'], completed=False) + number=field['number'], field_type=field['field_type'], completed=False) f.save() - j = j+1 # Return the newly created report data = get_reports(report.id)