-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from SmartReports/fix
Fix
- Loading branch information
Showing
14 changed files
with
928 additions
and
135 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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
smartreport_app/migrations | ||
# C extensions | ||
*.so | ||
db.sqlite3 | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,56 +1,58 @@ | ||
from django.contrib import admin | ||
from .models import Kpi, ReportTemplate, ReportTemplatePage, KpiReportElement, Alarm, ChartType | ||
from .models import ( | ||
Kpi, | ||
ReportTemplate, | ||
ReportTemplatePage, | ||
KpiReportElement, | ||
Alarm, | ||
) | ||
|
||
|
||
class KpiReportElementInline(admin.TabularInline): | ||
model = KpiReportElement | ||
extra = 1 | ||
|
||
|
||
class ReportTemplatePageInline(admin.TabularInline): | ||
model = ReportTemplatePage | ||
extra = 1 | ||
show_change_link = True | ||
inlines = [KpiReportElementInline] | ||
|
||
|
||
@admin.register(Kpi) | ||
class KpiAdmin(admin.ModelAdmin): | ||
list_display = ('name',) | ||
search_fields = ('name',) | ||
list_display = ("name",) | ||
search_fields = ("name",) | ||
|
||
|
||
@admin.register(ReportTemplate) | ||
class ReportTemplateAdmin(admin.ModelAdmin): | ||
list_display = ('name', 'frequency') | ||
list_filter = ('frequency',) | ||
list_display = ("name", "frequency") | ||
list_filter = ("frequency",) | ||
inlines = [ReportTemplatePageInline] | ||
|
||
|
||
@admin.register(ReportTemplatePage) | ||
class ReportTemplatePageAdmin(admin.ModelAdmin): | ||
list_display = ('report_template', 'layout') | ||
list_filter = ('layout',) | ||
list_display = ("report_template", "layout") | ||
list_filter = ("layout",) | ||
inlines = [KpiReportElementInline] | ||
|
||
|
||
@admin.register(KpiReportElement) | ||
class KpiReportElementAdmin(admin.ModelAdmin): | ||
list_display = ('report_page', 'kpi', 'chart_type') | ||
list_filter = ('chart_type',) | ||
list_display = ("report_page", "kpi", "chart_type") | ||
list_filter = ("chart_type",) | ||
|
||
|
||
@admin.register(Alarm) | ||
class AlarmAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'user_type', 'kpi', 'min_value', 'max_value') | ||
list_filter = ('user_type', 'kpi') | ||
search_fields = ('user_type', 'kpi__name') | ||
|
||
def get_kpi_name(self, obj): | ||
return obj.kpi.name | ||
|
||
get_kpi_name.short_description = 'KPI Name' | ||
|
||
@admin.register(ChartType) | ||
class ChartTypeAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'kpi', 'plot_name') | ||
list_filter = ('kpi',) | ||
search_fields = ('kpi__name',) | ||
list_display = ("id", "user_type", "kpi", "min_value", "max_value") | ||
list_filter = ("user_type", "kpi") | ||
search_fields = ("user_type", "kpi__name") | ||
|
||
def get_kpi_name(self, obj): | ||
return obj.kpi.name | ||
|
||
get_kpi_name.short_description = 'KPI Name' | ||
get_kpi_name.short_description = "KPI Name" |
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,86 @@ | ||
# Generated by Django 4.2.7 on 2023-11-11 10:08 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='DashboardLayout', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('user_type', models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], max_length=128)), | ||
('layout', models.CharField(max_length=2048)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Kpi', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255)), | ||
('user_type', models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], max_length=128)), | ||
('priority', models.IntegerField(default=0)), | ||
('isNew', models.BooleanField(default=True)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='ReportTemplate', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255)), | ||
('user_type', models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], max_length=128)), | ||
('frequency', models.CharField(choices=[('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('yearly', 'Yearly'), ('quarterly', 'Quarterly')], max_length=10)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='ReportTemplatePage', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('layout', models.CharField(choices=[('horizontal', 'Horizontal'), ('vertical', 'Vertical'), ('grid', 'Grid')], max_length=10)), | ||
('report_template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pages', to='smartreport_app.reporttemplate')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='KpiReportElement', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('chart_type', models.CharField(max_length=128)), | ||
('kpi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='smartreport_app.kpi')), | ||
('report_page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='elements', to='smartreport_app.reporttemplatepage')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='ChartType', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('plot_name', models.CharField(choices=[('line', 'line'), ('bar', 'bar'), ('pie', 'pie'), ('doughnut', 'doughnut'), ('radar', 'radar')], max_length=128)), | ||
('kpi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='allowed_charts', to='smartreport_app.kpi')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='ArchivedReport', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('file', models.FileField(upload_to='reports/')), | ||
('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='archived_reports', to='smartreport_app.reporttemplate')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Alarm', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('user_type', models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], max_length=128)), | ||
('min_value', models.FloatField()), | ||
('max_value', models.FloatField()), | ||
('kpi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='smartreport_app.kpi')), | ||
], | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
smartreport_app/migrations/0002_kpi_allowed_charts_delete_charttype.py
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,21 @@ | ||
# Generated by Django 4.2.7 on 2023-11-11 10:27 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='allowed_charts', | ||
field=models.JSONField(default=list), | ||
), | ||
migrations.DeleteModel( | ||
name='ChartType', | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
smartreport_app/migrations/0003_alter_kpi_allowed_charts.py
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,18 @@ | ||
# Generated by Django 4.2.7 on 2023-11-11 10:30 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0002_kpi_allowed_charts_delete_charttype'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='kpi', | ||
name='allowed_charts', | ||
field=models.JSONField(default=['line', 'bar', 'pie', 'doughnut', 'radar']), | ||
), | ||
] |
19 changes: 19 additions & 0 deletions
19
smartreport_app/migrations/0004_alter_kpi_allowed_charts.py
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,19 @@ | ||
# Generated by Django 4.2.7 on 2023-11-11 10:30 | ||
|
||
from django.db import migrations, models | ||
import smartreport_app.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0003_alter_kpi_allowed_charts'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='kpi', | ||
name='allowed_charts', | ||
field=models.JSONField(default=smartreport_app.models.DEFAULT_CHART_CHOICES), | ||
), | ||
] |
Empty file.
Oops, something went wrong.