SEED Package
Subpackages
- Features Package
- Management Package
- Mapping Package
- Templatetags Package
- Test Helpers Package
- Subpackages
- Test Helper Factor Package
- Subpackages
- Submodules
- Helpers
DjangoFunctionalFactory
DjangoFunctionalFactory.invalid_test_cc_number()
DjangoFunctionalFactory.rand_bool()
DjangoFunctionalFactory.rand_city()
DjangoFunctionalFactory.rand_city_suffix()
DjangoFunctionalFactory.rand_currency()
DjangoFunctionalFactory.rand_date()
DjangoFunctionalFactory.rand_domain()
DjangoFunctionalFactory.rand_email()
DjangoFunctionalFactory.rand_float()
DjangoFunctionalFactory.rand_int()
DjangoFunctionalFactory.rand_name()
DjangoFunctionalFactory.rand_phone()
DjangoFunctionalFactory.rand_plant_name()
DjangoFunctionalFactory.rand_str()
DjangoFunctionalFactory.rand_street_address()
DjangoFunctionalFactory.rand_street_suffix()
DjangoFunctionalFactory.test_cc_number()
DjangoFunctionalFactory.valid_test_cc_number()
- Test Helper Factor Package
- Module contents
- Subpackages
- Tests Package
- Submodules
- Test Helpers Package
- Subpackages
- Test Helper Factor Package
- Subpackages
- Submodules
- Helpers
DjangoFunctionalFactory
DjangoFunctionalFactory.invalid_test_cc_number()
DjangoFunctionalFactory.rand_bool()
DjangoFunctionalFactory.rand_city()
DjangoFunctionalFactory.rand_city_suffix()
DjangoFunctionalFactory.rand_currency()
DjangoFunctionalFactory.rand_date()
DjangoFunctionalFactory.rand_domain()
DjangoFunctionalFactory.rand_email()
DjangoFunctionalFactory.rand_float()
DjangoFunctionalFactory.rand_int()
DjangoFunctionalFactory.rand_name()
DjangoFunctionalFactory.rand_phone()
DjangoFunctionalFactory.rand_plant_name()
DjangoFunctionalFactory.rand_str()
DjangoFunctionalFactory.rand_street_address()
DjangoFunctionalFactory.rand_street_suffix()
DjangoFunctionalFactory.test_cc_number()
DjangoFunctionalFactory.valid_test_cc_number()
- Test Helper Factor Package
- Module contents
- Subpackages
- Tests (Functional) Package
- Test Helpers Package
- Admin Views
AdminViewsTest
AdminViewsTest.setUp()
AdminViewsTest.test_add_org()
AdminViewsTest.test_add_org_dupe()
AdminViewsTest.test_add_user_existing_org()
AdminViewsTest.test_add_user_new_org()
AdminViewsTest.test_add_user_no_org()
AdminViewsTest.test_signup_process()
AdminViewsTest.test_signup_process_force_lowercase_email()
- Decorators
ClassDecoratorTests
ClassDecoratorTests.test_ajax_request_class_dict()
ClassDecoratorTests.test_ajax_request_class_dict_status_error()
ClassDecoratorTests.test_ajax_request_class_dict_status_false()
ClassDecoratorTests.test_ajax_request_class_format_type()
ClassDecoratorTests.test_require_organization_id_class_no_org_id()
ClassDecoratorTests.test_require_organization_id_class_org_id()
ClassDecoratorTests.test_require_organization_id_class_org_id_not_int()
RequireOrganizationIDTests
RequireOrganizationIDTests.setUp()
RequireOrganizationIDTests.test_require_organization_id_fail_no_key()
RequireOrganizationIDTests.test_require_organization_id_fail_not_numeric()
RequireOrganizationIDTests.test_require_organization_id_success_integer()
RequireOrganizationIDTests.test_require_organization_id_success_string()
TestDecorators
TestException
- Exporters
- Models
- Tasks
- Views
GetDatasetsViewsTests
GetDatasetsViewsTests.setUp()
GetDatasetsViewsTests.test_delete_dataset()
GetDatasetsViewsTests.test_get_dataset()
GetDatasetsViewsTests.test_get_datasets()
GetDatasetsViewsTests.test_get_datasets_count()
GetDatasetsViewsTests.test_get_datasets_count_invalid()
GetDatasetsViewsTests.test_update_dataset()
ImportFileViewsTests
InventoryViewTests
InventoryViewTests.setUp()
InventoryViewTests.test_get_cycles()
InventoryViewTests.test_get_properties()
InventoryViewTests.test_get_properties_cycle_id()
InventoryViewTests.test_get_properties_empty_page()
InventoryViewTests.test_get_properties_page_not_an_integer()
InventoryViewTests.test_get_properties_pint_fields()
InventoryViewTests.test_get_properties_profile_id()
InventoryViewTests.test_get_properties_property_extra_data()
InventoryViewTests.test_get_properties_select_all()
InventoryViewTests.test_get_properties_taxlot_extra_data()
InventoryViewTests.test_get_properties_with_taxlots()
InventoryViewTests.test_get_properties_with_taxlots_with_footprints()
InventoryViewTests.test_get_properties_wrong_query_params()
InventoryViewTests.test_get_property()
InventoryViewTests.test_get_property_columns()
InventoryViewTests.test_get_property_multiple_taxlots()
InventoryViewTests.test_get_taxlot()
InventoryViewTests.test_get_taxlot_columns()
InventoryViewTests.test_get_taxlots()
InventoryViewTests.test_get_taxlots_empty_page()
InventoryViewTests.test_get_taxlots_extra_data()
InventoryViewTests.test_get_taxlots_multiple_taxlots()
InventoryViewTests.test_get_taxlots_no_cycle_id()
InventoryViewTests.test_get_taxlots_page_not_an_integer()
InventoryViewTests.test_get_taxlots_profile_id()
InventoryViewTests.test_postoffice()
InventoryViewTests.test_update_pint_fields_with_modified_display_settings()
MainViewTests
TestMCMViews
TestMCMViews.assert_expected_mappings()
TestMCMViews.expected_mappings
TestMCMViews.raw_columns_expected
TestMCMViews.setUp()
TestMCMViews.test_create_dataset()
TestMCMViews.test_get_column_mapping_suggestions()
TestMCMViews.test_get_column_mapping_suggestions_pm_file()
TestMCMViews.test_get_column_mapping_suggestions_with_columns()
TestMCMViews.test_get_raw_column_names()
TestMCMViews.test_progress()
TestMCMViews.test_save_column_mappings()
TestMCMViews.test_save_column_mappings_idempotent()
- Tests
- Utils
- Submodules
Inheritance
Submodules
Decorators
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.decorators.DecoratorMixin(decorator)
Converts a decorator written for a function view into a mixin for a class-based view.
Example:
LoginRequiredMixin = DecoratorMixin(login_required) class MyView(LoginRequiredMixin): pass class SomeView(DecoratorMixin(some_decorator), DecoratorMixin(something_else)): pass
- seed.decorators.ajax_request(func)
Copied from django-annoying, with a small modification. Now we also check for ‘status’ or ‘success’ keys and slash return correct status codes
If view returned serializable dict, returns response in a format requested by HTTP_ACCEPT header. Defaults to JSON if none requested or match.
Currently supports JSON or YAML (if installed), but can easily be extended.
Example:
@ajax_request def my_view(request): news = News.objects.all() news_titles = [entry.title for entry in news] return { 'news_titles': news_titles }
- seed.decorators.ajax_request_class(func)
Copied from django-annoying, with a small modification. Now we also check for ‘status’ or
‘success’ keys and return correct status codes
If view returned serializable dict, returns response in a format requested by HTTP_ACCEPT header. Defaults to JSON if none requested or match.
Currently supports JSON or YAML (if installed), but can easily be extended.
Example:
@ajax_request def my_view(self, request): news = News.objects.all() news_titles = [entry.title for entry in news] return { 'news_titles': news_titles }
- seed.decorators.get_prog_key(func_name, import_file_pk)
Return the progress key for the cache
- seed.decorators.lock_and_track(fn, *args, **kwargs)
Decorator to lock tasks to single executor and provide progress url.
- seed.decorators.require_organization_id(func)
Validate that organization_id is in the GET params and it’s an int.
- seed.decorators.require_organization_id_class(fn)
Validate that organization_id is in the GET params and it’s an int.
- seed.decorators.require_organization_membership(fn)
Validate that the organization_id passed in GET is valid for request user.
Factory
Models
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
Search
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
Search methods pertaining to buildings.
returns a list of sibling and parent orgs
- seed.search.create_inventory_queryset(inventory_type, orgs, exclude, order_by, other_orgs=None, cycle_id=None)
creates a queryset of properties or taxlots within orgs. If
other_orgs
, properties/taxlots in both orgs and other_orgs will be represented in the queryset.- Parameters:
inventory_type – property or taxlot.
orgs – queryset of Organization inst.
exclude – django query exclude dict.
order_by – django query order_by str.
other_orgs – list of other orgs to
or
the query
- seed.search.get_inventory_fieldnames(inventory_type)
returns a list of field names that will be searched against
- seed.search.get_orgs_w_public_fields()
returns a list of orgs that have publicly shared fields
- seed.search.inventory_search_filter_sort(inventory_type, params, user, cycle_id=None)
Given a parsed set of params, perform the search, filter, and sort for Properties or Taxlots
- seed.search.parse_body(request)
parses the request body for search params, q, etc
- Parameters:
request – django wsgi request object
- Returns:
dict
Example:
{ 'exclude': dict, exclude dict for django queryset 'order_by': str, query order_by, defaults to 'tax_lot_id' 'sort_reverse': bool, True if ASC, False if DSC 'page': int, pagination page 'number_per_page': int, number per pagination page 'show_shared_buildings': bool, whether to search across all user's orgs 'q': str, global search param 'other_search_params': dict, filter params 'project_id': str, project id if exists in body }
- seed.search.process_search_params(params, user, is_api_request=False)
Given a python representation of a search query, process it into the internal format that is used for searching, filtering, sorting, and pagination.
- Parameters:
params – a python object representing the search query
user – the user this search is for
is_api_request – bool, boolean whether this search is being done as an api request.
- Returns:
dict
Example:
{ 'exclude': dict, exclude dict for django queryset 'order_by': str, query order_by, defaults to 'tax_lot_id' 'sort_reverse': bool, True if ASC, False if DSC 'page': int, pagination page 'number_per_page': int, number per pagination page 'show_shared_buildings': bool, whether to search across all user's orgs 'q': str, global search param 'other_search_params': dict, filter params 'project_id': str, project id if exists in body }
- seed.search.search_inventory(inventory_type, q, fieldnames=None, queryset=None)
returns a queryset for matching Taxlot(View)/Property(View) :param str or unicode q: search string :param list fieldnames: list of model fieldnames :param queryset: optional queryset to filter from :returns: :queryset: queryset of matching buildings
- seed.search.search_properties(q, fieldnames=None, queryset=None)
- seed.search.search_taxlots(q, fieldnames=None, queryset=None)
Tasks
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.tasks.delete_organization(org_pk)
delete_organization_buildings
- seed.tasks.invite_new_user_to_seed(domain, email_address, token, user_pk, first_name)
Send invitation email to newly created user from the landing page. NOTE: this function is only used on the landing page because the user has not been assigned an organization domain – The domain name of the running seed instance email_address – The address to send the invitation to token – generated by Django’s default_token_generator user_pk – primary key for this user record first_name – First name of the new user new_user
Returns: nothing
- seed.tasks.send_salesforce_error_log(org_pk, errors)
send salesforce error log to logging email when errors are encountered during scheduled sync
Token Generator
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
- author:
Aleck Landgraf
token_generator.py - taken from django core master branch
needed a token check that would not expire after three days for sending a signup email
- class seed.token_generators.SignupTokenGenerator
Bases:
object
Strategy object used to generate and check tokens for the password reset mechanism.
- check_token(user, token, token_expires=True)
Check that a password reset token is correct for a given user.
- make_token(user)
Returns a token that can be used once to do a password reset for the given user.
Utils
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
Views
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
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