Views Package

Submodules

Accounts

APIs

SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md

seed.views.api.get_api_schema(self, request, *args, **kwargs)

Returns a hash of all API endpoints and their descriptions.

Returns:

{
    '/example/url/here': {
        'name': endpoint name,
        'description': endpoint description
    }...
}

Todo

Format docstrings better.

Main

SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md

seed.views.main.angular_js_tests(request)

Jasmine JS unit test code covering AngularJS unit tests

seed.views.main.celery_queue(self, request, *args, **kwargs)

Returns the number of running and queued celery tasks. This action can only be performed by superusers

Returns:

{
    'active': {'total': n, 'tasks': []}, // Tasks that are currently being executed
    'reserved': {'total': n, 'tasks': []}, // Tasks waiting to be executed
    'scheduled': {'total': n, 'tasks': []}, // Tasks reserved by the worker when they have an eta or countdown
    'maxConcurrency': The maximum number of active tasks
}
seed.views.main.delete_file(self, request, *args, **kwargs)

Deletes an ImportFile from a dataset.

Payload:

{
    "file_id": "ImportFile id",
    "organization_id": "current user organization id as integer"
}

Returns:

{
    'status': 'success' or 'error',
    'message': 'error message, if any'
}
seed.views.main.delete_organization_inventory(self, request, *args, **kwargs)

Starts a background task to delete all properties & taxlots in an org.

DELETE

Expects ‘org_id’ for the organization.

Returns:

{
    'status': 'success' or 'error',
    'progress_key': ID of background job, for retrieving job progress
}
seed.views.main.error404(request, exception)
seed.views.main.error500(request)
seed.views.main.get_default_building_detail_columns(self, request, *args, **kwargs)

Get default columns for building detail view.

front end is expecting a JSON object with an array of field names

Returns:

{
    "columns": ["project_id", "name", "gross_floor_area"]
}
seed.views.main.home(request)

the main view for the app Sets in the context for the django template:

  • app_urls: a json object of all the URLs that is loaded in the JS global namespace

  • username: the request user’s username (first and last name)

seed.views.main.public_search(request)

The public API unauthenticated endpoint

seed.views.main.set_default_building_detail_columns(self, request, *args, **kwargs)
seed.views.main.set_default_columns(self, request, *args, **kwargs)
seed.views.main.version(self, request, *args, **kwargs)

Returns the SEED version and current git sha

Meters

SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md

class seed.views.meters.MeterViewSetV2(**kwargs)

Bases: seed.utils.viewsets.SEEDOrgCreateUpdateModelViewSet

greenbutton_parsed_meters_confirmation(request)
model

alias of seed.models.meters.Meter

orgfilter = 'property__organization'
pagination_class = None
parsed_meters_confirmation(request)
parser_classes: tuple[Any, ...] = (<class 'rest_framework.parsers.JSONParser'>,)
property_meter_usage(request)
property_meters(request)
renderer_classes = (<class 'rest_framework.renderers.JSONRenderer'>,)
serializer_class

alias of seed.serializers.meters.MeterSerializer

valid_types_units(request)

Module contents

SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md