-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into Move-show-populated-to-backend
- Loading branch information
Showing
33 changed files
with
963 additions
and
110 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Generated by Django 3.2.25 on 2024-10-22 15:39 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("orgs", "0039_alter_organization_ubid_threshold"), | ||
("seed", "0231_column_is_updating"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ReportConfiguration", | ||
fields=[ | ||
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("name", models.CharField(max_length=255)), | ||
( | ||
"access_level_instance", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="report_configurations", | ||
to="orgs.accesslevelinstance", | ||
), | ||
), | ||
("access_level_depth", models.IntegerField(null=True)), | ||
("cycles", models.ManyToManyField(related_name="report_configurations", to="seed.Cycle")), | ||
( | ||
"filter_group", | ||
models.ForeignKey( | ||
null=True, on_delete=django.db.models.deletion.CASCADE, related_name="report_configurations", to="seed.filtergroup" | ||
), | ||
), | ||
( | ||
"organization", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, related_name="report_configurations", to="orgs.organization" | ||
), | ||
), | ||
("x_column", models.CharField(max_length=255, null=True)), | ||
("y_column", models.CharField(max_length=255, null=True)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. | ||
See also https://github.com/SEED-platform/seed/blob/main/LICENSE.md | ||
""" | ||
|
||
from django.db import models | ||
|
||
from seed.lib.superperms.orgs.models import AccessLevelInstance, Organization | ||
from seed.models.cycles import Cycle | ||
from seed.models.filter_group import FilterGroup | ||
|
||
|
||
class ReportConfiguration(models.Model): | ||
name = models.CharField(max_length=255) | ||
organization = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name="report_configurations", null=False) | ||
x_column = models.CharField(max_length=255, null=True) | ||
y_column = models.CharField(max_length=255, null=True) | ||
cycles = models.ManyToManyField(Cycle, related_name="report_configurations") | ||
filter_group = models.ForeignKey(FilterGroup, on_delete=models.CASCADE, related_name="report_configurations", null=True) | ||
access_level_instance = models.ForeignKey( | ||
AccessLevelInstance, on_delete=models.CASCADE, related_name="report_configurations", null=True | ||
) | ||
access_level_depth = models.IntegerField(null=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. | ||
See also https://github.com/SEED-platform/seed/blob/main/LICENSE.md | ||
""" | ||
|
||
from rest_framework import serializers | ||
|
||
from seed.models import ReportConfiguration | ||
|
||
|
||
class ReportConfigurationSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = ReportConfiguration | ||
fields = ("name", "cycles", "id", "x_column", "y_column", "filter_group_id", "access_level_instance_id", "access_level_depth") | ||
extra_kwargs = {"user": {"read_only": True}, "organization": {"read_only": True}, "organization_id": {"read_only": True}} | ||
|
||
def to_representation(self, instance): | ||
ret = super().to_representation(instance) | ||
|
||
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.