Commit 9512a3db authored by Alan Mitchell's avatar Alan Mitchell

Added new fields to Admin and made migrations.

parent b6c8e593
......@@ -6,6 +6,7 @@ from bmsapp.models import Building, Sensor, SensorGroup, BldgToSensor, Dashboard
from bmsapp.models import MultiBuildingChart, ChartBuildingInfo, CustomReport
from bmsapp.models import Organization, BuildingGroup, BuildingMode
from bmsapp.models import AlertCondition, AlertRecipient, PeriodicScript
from bmsapp.models import FuelRate, ElectricRate
from django.contrib import admin
from django.forms import TextInput, Textarea
from django.db import models
......@@ -211,4 +212,12 @@ class SensorAdmin(admin.ModelAdmin):
@admin.register(CustomReport)
class CustomReportAdmin(admin.ModelAdmin):
list_display = ('title', 'group')
formfield_overrides = {models.TextField: {'widget': Textarea(attrs={'rows':20, 'cols':80})}}
\ No newline at end of file
formfield_overrides = {models.TextField: {'widget': Textarea(attrs={'rows':20, 'cols':80})}}
@admin.register(FuelRate)
class FuelRateAdmin(admin.ModelAdmin):
list_display = ('title',)
@admin.register(ElectricRate)
class ElectricRateAdmin(admin.ModelAdmin):
list_display = ('title',)
# Generated by Django 2.1.7 on 2019-08-13 00:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bmsapp', '0028_auto_20190418_2017'),
]
operations = [
migrations.CreateModel(
name='ElectricRate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=80, unique=True)),
('sort_order', models.IntegerField(default=999)),
('customer_charge', models.FloatField(default=0.0, help_text='This charge is assessed every month, irrespective of usage.', verbose_name='Monthly Fixed Customer Charge, $/month')),
('rate1', models.FloatField(default=0.0, verbose_name='Rate for first block of usage, $/kWh')),
('block1', models.FloatField(blank=True, help_text='Leave this entry blank if there are no usage blocks and the first rate applies to all kWh.', null=True, verbose_name='1st Block size in kWh, leave blank to apply to all kWh')),
('rate2', models.FloatField(blank=True, help_text='Only used if there is a second usage block.', null=True, verbose_name='Rate for second block of usage, if present, $/kWh')),
('demand_charge', models.FloatField(default=0.0, help_text='Generally not used except for Large Commercial rate structures.', verbose_name='Demand Charge for maximum 15 minute power, $/kW/mo')),
],
options={
'ordering': ['sort_order', 'title'],
},
),
migrations.CreateModel(
name='FuelRate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=80, unique=True)),
('sort_order', models.IntegerField(default=999)),
('customer_charge', models.FloatField(default=0.0, help_text='This charge is assessed every month, irrespective of usage.', verbose_name='Monthly Fixed Customer Charge, $/month')),
('rate', models.FloatField(default=0.0, verbose_name='Fuel Price expressed in $/MMBtu')),
],
options={
'ordering': ['sort_order', 'title'],
},
),
migrations.AddField(
model_name='building',
name='building_type',
field=models.CharField(blank=True, choices=[('S-RES', 'Single-Family Residential'), ('M-RES', 'Multi-Family Residential'), ('OFFIC', 'Office'), ('SCH', 'School'), ('RET', 'Retail'), ('WARE', 'Warehouse'), ('INDUS', 'Industrial'), ('OTHER', 'Other')], max_length=5, null=True, verbose_name='Building Type'),
),
migrations.AddField(
model_name='building',
name='co2_sensors',
field=models.TextField(blank=True, verbose_name='CO2 Sensor IDs, one per line'),
),
migrations.AddField(
model_name='building',
name='electric_ids',
field=models.TextField(blank=True, help_text='Sensors will be added together to determine total electric use.', verbose_name='Building Electric Power Sensor IDs, one per line'),
),
migrations.AddField(
model_name='building',
name='floor_area',
field=models.FloatField(blank=True, null=True, verbose_name='Floor area of Building in square feet'),
),
migrations.AddField(
model_name='building',
name='fuel_ids',
field=models.TextField(blank=True, help_text='Sensors will be added together to determine total fuel use.', verbose_name='Building Fuel Use Sensor IDs, one per line'),
),
migrations.AddField(
model_name='building',
name='indoor_lights',
field=models.TextField(blank=True, verbose_name='Indoor Light Sensor IDs, one per line'),
),
migrations.AddField(
model_name='building',
name='indoor_temps',
field=models.TextField(blank=True, verbose_name='Indoor Temperature Sensor IDs, one per line'),
),
migrations.AddField(
model_name='building',
name='outdoor_temp',
field=models.CharField(blank=True, max_length=80, verbose_name='Outdoor Temperature Sensor ID'),
),
migrations.AddField(
model_name='building',
name='electric_rate',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='bmsapp.ElectricRate', verbose_name='Electric Rate Schedule for Building'),
),
migrations.AddField(
model_name='building',
name='fuel_rate',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='bmsapp.FuelRate', verbose_name='Primary Fuel Price for Building'),
),
]
# Generated by Django 2.1.7 on 2019-08-13 00:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bmsapp', '0029_auto_20190812_1607'),
]
operations = [
migrations.AlterField(
model_name='building',
name='building_type',
field=models.CharField(blank=True, choices=[('S-RES', 'Single-Family Residential'), ('M-RES', 'Multi-Family Residential'), ('OFFIC', 'Office'), ('SCH', 'School'), ('RET', 'Retail'), ('RES', 'Restaurant'), ('WARE', 'Warehouse'), ('INDUS', 'Industrial'), ('OTHER', 'Other')], max_length=5, null=True, verbose_name='Building Type'),
),
]
......@@ -287,6 +287,7 @@ class Building(models.Model):
OFFICE = 'OFFIC'
SCHOOL = 'SCH'
RETAIL = 'RET'
RESTAURANT = 'RES'
WAREHOUSE = 'WARE'
INDUSTRIAL = 'INDUS'
OTHER = 'OTHER'
......@@ -297,6 +298,7 @@ class Building(models.Model):
(OFFICE, 'Office'),
(SCHOOL, 'School'),
(RETAIL, 'Retail'),
(RESTAURANT, 'Restaurant'),
(WAREHOUSE, 'Warehouse'),
(INDUSTRIAL, 'Industrial'),
(OTHER, 'Other')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment