11# Generated by Django 5.1.15 on 2026-02-03 21:41
22
3+ from decimal import Decimal
34from django .db import migrations
45
56
6- def add_product (apps , schema_monitor ):
7+ def add_product_and_pwaei (apps , schema_monitor ):
78 '''
89 Add the new Pulp & Paper: Lime Revovery Kiln
910 '''
1011 RegulatedProduct = apps .get_model ('registration' , 'RegulatedProduct' )
12+ ProductEmissionIntensity = apps .get_model ('reporting' , 'ProductEmissionIntensity' )
13+
1114 RegulatedProduct .objects .create (
12- name = "Pulp and paper: lime recovery kiln" ,
15+ name = "Pulp and paper: lime recovered by kiln" ,
1316 unit = "Tonnes dry recovered lime (calcium oxide)" ,
1417 is_regulated = True ,
1518 )
19+ ProductEmissionIntensity .objects .create (
20+ product_id = RegulatedProduct .objects .get (name = "Pulp and paper: lime recovered by kiln" ).id ,
21+ product_weighted_average_emission_intensity = Decimal ("0.3822" ),
22+ valid_from = '2023-01-01' ,
23+ valid_to = '9999-12-31' ,
24+ )
1625
1726
18- def reverse_add_product (apps , schema_monitor ):
27+ def reverse_add_product_and_pwaei (apps , schema_monitor ):
1928 RegulatedProduct = apps .get_model ('registration' , 'RegulatedProduct' )
20- RegulatedProduct .objects .filter (name = "Pulp and paper: lime recovery kiln" ).delete ()
29+ ProductEmissionIntensity = apps .get_model ('reporting' , 'ProductEmissionIntensity' )
30+
31+ ProductEmissionIntensity .objects .filter (product__name = "Pulp and paper: lime recovered by kiln" ).delete ()
32+ RegulatedProduct .objects .filter (name = "Pulp and paper: lime recovered by kiln" ).delete ()
2133
2234
2335class Migration (migrations .Migration ):
@@ -27,5 +39,5 @@ class Migration(migrations.Migration):
2739 ]
2840
2941 operations = [
30- migrations .RunPython (add_product , reverse_add_product ),
42+ migrations .RunPython (add_product_and_pwaei , reverse_add_product_and_pwaei ),
3143 ]
0 commit comments