-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: TP2000-1018 - expose report endpoints to tariff managers (#1029)
- Loading branch information
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
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,29 @@ | ||
# Generated by Django 3.2.20 on 2023-09-11 14:27 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Report", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
], | ||
options={ | ||
"db_table": "report", | ||
}, | ||
), | ||
] |
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,30 @@ | ||
from django.contrib.auth.models import Permission, Group | ||
from django.contrib.contenttypes.models import ContentType | ||
from reports.models import Report | ||
from django.db import migrations | ||
|
||
|
||
def create_custom_permissions(apps, schema_editor): | ||
content_type = ContentType.objects.get_for_model(Report) | ||
|
||
view_permission, _ = Permission.objects.get_or_create( | ||
codename="view_report_index", | ||
name="Can view report index", | ||
content_type=content_type, | ||
) | ||
|
||
edit_permission, _ = Permission.objects.get_or_create( | ||
codename="view_report", | ||
name="Can view reports", | ||
content_type=content_type, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("reports", "0001_report"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_custom_permissions), | ||
] |
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 |
---|---|---|
@@ -1 +1,7 @@ | ||
# Create your models here. | ||
from django.db import models | ||
|
||
|
||
class Report(models.Model): | ||
class Meta: | ||
# Define the name for the database table (optional) | ||
db_table = "report" |
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