SEED-platform / seed

Standard Energy Efficiency Data (SEED) Platform™ is a web-based application that helps organizations easily manage data on the energy performance of large groups of buildings.
Other
106 stars 55 forks source link

Auto-populate Sample Data fails, OrganizationViewSet doesn’t have an org attribute #4702

Open devinbrady opened 6 days ago

devinbrady commented 6 days ago

Describe the bug

On a fresh installation of SEED, when I click the "Auto-Populate Sample Data" button on the home page, I get an error saying that the OrganizationViewSet doesn’t have an org attribute.

End of the stack trace:

  File "/seed/seed/views/v3/organizations.py", line 1236, in insert_sample_data
    import_record = ImportRecord.objects.create(name="Auto-Populate", super_organization=org, access_level_instance=self.org.root)
AttributeError: 'OrganizationViewSet' object has no attribute 'org'
"GET /api/v3/organizations/1/insert_sample_data/ HTTP/1.1" 500 16910

The line in question: https://github.com/SEED-platform/seed/blob/develop/seed/views/v3/organizations.py#L1236

Expected Behavior

Sample data should be fully populated into the database and the GET call to insert_sample_data should return 200.

Actual Behavior

The sample data is partially inserted into the database and the GET call returns 500.

Steps to Reproduce

  1. Checkout the develop branch
  2. Build new containers
  3. Run migrations
  4. Create a user
  5. Click the "Auto-Populate Sample Data" button on the home page
  6. Error follows

Instance Information

Local instance on Mac running Apple Silicon.