crop package
crop.forms module
- class crop.forms.BaseCropProductForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- save(commit=True, *args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.CropProductBatchImportForm(*args, **kwargs)
Bases:
farm.forms.BaseBatchImportForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.CropProductEnergyProcessingForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Conditional dependencies
- property media
Return all media required to render the widgets on this form.
- save(*args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.CropProductForm(*args, **kwargs)
Bases:
crop.forms.BaseCropProductForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- class crop.forms.CropProductSOCTreeBiomassForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- save(*args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.CropProductTransportForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- save(*args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.CropProductTreatmentForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- save(commit=True, *args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.CropProductWaterForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- save(commit=True, *args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.DatasetForm(*args, **kwargs)
Bases:
django.forms.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.FromFSAForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.GrowingAreaForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- save(*args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.IrrigationEventForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.MachineUseForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- class crop.forms.PesticideApplicationForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- class crop.forms.ProcessingForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.SoilOrganicCarbonBaseFormSetBase(data=None, files=None, instance=None, save_as_new=False, prefix=None, queryset=None, **kwargs)
Bases:
coolfarmtool.forms.BaseInlineFormSet
Base formset for SOC prior changes.
- clean()
Hook for doing any extra formset-wide cleaning after Form.clean() has been called on every form. Any ValidationError raised by this method will not be associated with a particular form; it will be accessible via formset.non_form_errors()
- class crop.forms.SoilOrganicCarbonManagementPracticeChangeForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- property media
Return all media required to render the widgets on this form.
- save(commit=True) crop.models.SoilOrganicCarbonManagementPracticeChange
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.StorageForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- class crop.forms.TreeBiomassForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.WaterCropProductForm(*args, **kwargs)
Bases:
crop.forms.BaseCropProductForm
- property media
Return all media required to render the widgets on this form.
- class crop.forms.WaterCropProductWaterForm(*args, **kwargs)
Bases:
coolfarmtool.forms.ConditionalModelForm
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- save(commit=True, *args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.WaterGrowingAreaForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- save(*args, **kwargs)
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
- class crop.forms.WaterIrrigationEventForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)
Bases:
coolfarmtool.forms.ConditionalModelForm
- property media
Return all media required to render the widgets on this form.
- crop.forms.combine_dropdown_choices(changes_model: Union[Type[crop.models.Tillage], Type[crop.models.LandUse], Type[crop.models.CarbonInput]]) List
Combinations function for SOC prior changes choice fields.
- crop.forms.combine_value(from_model: Union[crop.models.Tillage, crop.models.LandUse, crop.models.CarbonInput], to_model: Union[crop.models.Tillage, crop.models.LandUse, crop.models.CarbonInput]) str
Combine values from two input models.
crop.models module
Crop-specific storage and calculations, including:
fertiliser- and soil-induced emissions
machinery (incl. fuel use calculation)
management practice changes
irrigation and storage calculators
- class crop.models.AustraliaCropType(*args, **kwargs)
Bases:
django.db.models.base.Model
Australia specific crop type factors.
- exception DoesNotExist
- exception MultipleObjectsReturned
- root_shoot_ratio
Ratio of above-ground to below-ground biomass - RS(T)
- class crop.models.BaseCropProduct(*args, **kwargs)
Bases:
farm.models.Product
Single rotation of a
CropType
Shared properties for GHG/water and water-only assessments
- class IrrigationMethod(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class IrrigationPowerSource(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class IrrigationWaterSource(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- field_size = <quantity.models.QuantityField: field_size>
Physical growing area size
- product_fresh = <quantity.models.QuantityField: product_fresh>
Harvested amount
- class crop.models.BaseIrrigationEvent(*args, **kwargs)
Bases:
django.db.models.base.Model
Irrigation properties for a time period
- class WaterSource(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- property water_added_volume
Return a volume if water_added is a depth then it is converted
- property water_per_area
Calculated water added per area for this irrigation event
- class crop.models.CarbonInput(id, name_key, name, order)
Bases:
crop.models.AbstractLookupElement
- exception DoesNotExist
- exception MultipleObjectsReturned
- save(*args, **kwargs) None
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- class crop.models.CarbonInputsLookup(id, climate_zone, carbon_input, factor)
Bases:
crop.models.AbstractSoilOrganicCarbonLookup
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.CropProduct(*args, **kwargs)
Bases:
crop.models.BaseCropProduct
,crop.models.APICropResultsMixin
Single rotation of a
CropType
, water/GHG assessments- exception DoesNotExist
- class IrrigationCalculationType(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class LinkedSoilCarbonChange(current_soc_change: crop.models.SoilOrganicCarbonManagementPracticeChange, year_of_change: Union[int, decimal.Decimal], allocation: Union[int, decimal.Decimal], tillage_from: crop.models.Tillage, land_use_from: crop.models.LandUse, carbon_inputs_from: crop.models.CarbonInput, tillage_to: crop.models.Tillage, land_use_to: crop.models.LandUse, carbon_inputs_to: crop.models.CarbonInput, previous_soc_change: Optional[crop.models.SoilOrganicCarbonManagementPracticeChange] = None)
Bases:
object
Class used for the purpose of building linked display names used in API and UI.
- exception MultipleObjectsReturned
- class PaddyResidue(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class PaddyWaterCultivation(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class PaddyWaterPreseason(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- _e_paddy(fertilisers=None)
Underlying calculations for paddy field emissions
- Returns
quantity.Quantity
- _e_seed(**kwargs)
Underlying calculations for potato seed emissions
- Returns
quantity.Quantity
- _e_soc_change_emissions()
Calculated C stock changes from management practice changes
Based on Ogle et al. (2005), and incorporating organic input changes derived from the Smith et al. (1997) model.
- _e_soc_tree_biomass()
Emissions from tree biomass for a given SOC change either to or from a forest type, in kg |CO2 Calculate emissions from tree biomass in kg CO2 based on a change in land use classification to or from a forest type. Biomass values are retrieved from the ForestBiomass model and the root-shoot ratio is used to calculate below ground biomass. The emissions calculation considers the age of the forest and whether the change is an afforestation or deforestation.
- _e_soil_n2o
Calculate soil N2O emissions.
N2O emissions from annual amount of N in mineral soils that is mineralised, in association with loss of soil Carbon from soil organic matter as a result of changes to land use or management in regions where leaching/runoff occurs.
- _emissions_management
Calculated C stock changes from management practice changes
Based on Ogle et al. (2005), and incorporating organic input changes derived from the Smith et al. (1997) model.
- _emissions_paddy
Calculated CH4 emissions from organic decomposition in paddy fields
From IPCC (2006) ch. 5
- _emissions_pesticide
Total embedded emissions in applied pesticides (using default factor), in kg CO2e
- _emissions_residue
Total emissions from residue management, in kg CO2e
- _emissions_residue_ch4
Calculated CH4 emissions from residue management, in kg CH4
- _emissions_residue_n2o
Calculated N2O emissions from residue management, in kg N2O
- _emissions_seed
Calculated emissions arising from seed production
Scaling of
emissions_total
by the ratio of seed amount:product amount. i.e. assumes that seed production has the same impact as the current crop product.
- _emissions_soil_fertiliser
Total emissions from soil and fertiliser applications, in kg CO2e
- _emissions_tree_biomass_agg()
duplicate of above cached property, but with aggregation only summing the negative values
- biological_nitrogen_fixation
Calculate the BNF (Biological Nitrogen Fixation).
Product fresh is converted to kg. It will raise a TypeError if product_fresh or product_dry are in a non-weight unit.
return: BNF value which has Kg N unit.
- copy(new_footprint_name)
Method used for the save as functionality, by retrieving and copying related objects
- emissions_machine_use
Calculated CO2e emissions from machinery operations, in kg CO2e
- emissions_soil_fertiliser_n2o
Calculate N2O emissions from soil and fertiliser applications, in kg N2O .
- fertiliser_applications()
Shortcut to fertiliser applications which cannot be overridden or set :return: Queryset of fertiliser applications associated in the DB (or cached)
- get_emission_details(k)
Adds the details of each section to the results export.
- growing_area
Field (
GrowingArea
) on which this crop was grown
- property has_regionalised_calculations
Determines if calculations are run using regionalised data or methods.
- has_soc_tree_biomass
Whether any part of the associated
GrowingArea
had been converted to a different land-use category in the 20 years up toreporting_year
- is_from_forest() bool
Checks if the SOC change containing the forest is a ‘to’ forest or a ‘from’ forest
- is_to_forest() bool
Checks if the SOC change containing the forest is a ‘to’ forest or a ‘from’ forest
- luc_forest
Forest type (if any part of the associated
GrowingArea
was converted to or from a forest)
- luc_forest_age
Forest age (if any part of the associated
GrowingArea
was converted to or from a forest)
- management_changes
ManagementPracticeChange
s made while growing this crop, or in the 20 years precedingreporting_year
- n_deposition
Return n_deposition value which has kg N unit.
Note: Farm coordinates truncate and sum with 0.5 to find closest nitrogen deposition coordinates.
- n_input
Return n_input value which has kg N unit.
- n_removed
Return n_removed value which has kg N unit.
It will raise a TypeError if product_fresh or product_dry are in a non-weight unit.
- nitrogen_use_efficiency
Return the nitrogen use efficiency percentage or Decimal(nan) when non-weight units are used.
- pesticide_applications()
Shortcut to pesticide applications which cannot be overridden or set :return: Queryset of fertiliser applications associated in the DB (or cached)
- product_rejected = <quantity.models.QuantityField: product_rejected>
Rejected amount
- residue_amount = <quantity.models.QuantityField: residue_amount>
quantity.Quantity
of crop residue
- residue_management
ResidueManagementType
used with this crop’s residue
- seed_amount = <quantity.models.QuantityField: seed_amount>
Amount of seed used
Warning
Only potatoes are supported at present
- soc_current_practice_has_land_use_change() bool
Checks if the current SOC change has a land use change
- unharvested_reason_1
1st
RejectedReason
for unharvested crops
- unharvested_reason_2
2nd
RejectedReason
for unharvested crops
- unharvested_reason_3
3rd
RejectedReason
for unharvested crops
- property weighting
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4
- class crop.models.CropType(*args, **kwargs)
Bases:
django.db.models.base.Model
Defined variety of arable crop
- class BouwmanCategory(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- exception DoesNotExist
- exception MultipleObjectsReturned
- root_shoot_ratio
Ratio of above-ground to below-ground biomass
- class crop.models.CropTypeCategory(id, name, description)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.ForestBiomass(*args, **kwargs)
Bases:
django.db.models.base.Model
Out of crop tree biomass yearly production
- exception DoesNotExist
- exception MultipleObjectsReturned
- gt_20_year
Whether this data refers to a forest older than 20 years
- root_shoot_ratio
Ratio of above-ground to below-ground biomass
- class crop.models.ForestType(id, name, description)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.GrowingArea(id, label, soil_moisture_sowing, soil_type, farm, custom_soc_years_ago, soil_moisture, soil_texture, soil_drainage, soil_ph, soil_organic_matter, soil_organic_matter_custom)
Bases:
crop.models.BaseGrowingArea
- exception DoesNotExist
- exception MultipleObjectsReturned
- class SoilDrainage(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class SoilMoisture(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class SoilOrganicMatter(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class SoilTexture(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
Class describing the texture of a given soil.
- class Soil_pH(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- property soil_c_content
Tonnes of carbon in the top 30cm of soil, per hectare
- property soil_cec
Soil cation exchange capacity, in meq+/100g (?)
- property soil_organic_carbon: decimal.Decimal
SOC percentage
SOC = SOM × (1 / 1.72)
- class crop.models.IPCCSoilEquilibriumLookup(id, climate_zone, soil_characteristics, factor)
Bases:
crop.models.AbstractSoilOrganicCarbonLookup
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.IrrigationEvent(id, area_irrigated, water_source, has_source_pump, water_added_value, water_added_unit, product, power_source, pumping_value, pumping_unit, distance_value, distance_unit)
Bases:
crop.models.BaseIrrigationEvent
- exception DoesNotExist
- exception MultipleObjectsReturned
- class PowerSource(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- property emissions
Calculated CO2 emissions from this irrigation, in kg CO2e
- property energy_requirement
Replicated as per section 2.6.5 of the CFT calculation documentation Calculate the energy requirement using: Distance as KM (kilometres) Depth (pumping) as M (metres) :return: Quantity() in kwh
- property energy_use
Calculated energy use in MJ per area per mm water; see p. 6 in Haverkort&Hillier2012.pdf Revised in 2021 to ensure accurate results
- product
Irrigation properties
- class crop.models.LandUse(id, name_key, name, order)
Bases:
crop.models.AbstractLookupElement
- exception DoesNotExist
- exception MultipleObjectsReturned
- save(*args, **kwargs) None
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- class crop.models.LandUseLookup(id, climate_zone, land_use, factor)
Bases:
crop.models.AbstractSoilOrganicCarbonLookup
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.Machine(*args, **kwargs)
Bases:
django.db.models.base.Model
A type of farm machinery
- exception DoesNotExist
- class MachineType(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- exception MultipleObjectsReturned
- machine_type
Machine category
- class crop.models.MachineFuelUse(*args, **kwargs)
Bases:
django.db.models.base.Model
Predefined consumption rate for a specific fuel, per operation, per hectare (and dependent on soil texture)
- exception DoesNotExist
- exception MultipleObjectsReturned
- fuel_type
Fuel type, as a
django.db.models.ForeignKey
tofactor.models.Factor
- rate
Fuel consumption, in litres per operation per hectare
- class crop.models.MachineFuelUseVersion(*args, **kwargs)
Bases:
coolfarmtool.mixins.LastUpdatedMixin
,django.db.models.base.Model
Predefined consumption rate for a specific fuel, per operation, per hectare (and dependent on soil texture)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.MachineUse(*args, **kwargs)
Bases:
farm.models.LabelMixin
,django.db.models.base.Model
A number of operations of a
Machine
on aCropProduct
- exception DoesNotExist
- exception MultipleObjectsReturned
- property emissions
Calculated CO2 emissions from these operations, in tonnes CO2e
- fuel_type
Fuel type, as a
django.db.models.ForeignKey
tofactor.models.Factor
- property fuel_use
Calculated fuel use, in litres
- get_machine_fuel_use_factor()
Choose the MachineFuelUse factor to use according to this logic: 1. If the machine is not deprecated, always use the diesel biofuel blend factor 2. If the machine is deprecated and diesel is used as fuel, use the diesel biofuel blend factor 3. If the machine is deprecated and petrol is used as fuel, use the petrol biofuel blend factor
- number_of_bales
Number of bales if Machine is a baler
- operations
Number of operations
- product
Relevant
CropProduct
- class crop.models.ManagementPractice(*args, **kwargs)
Bases:
django.db.models.base.Model
Field (GrowingArea) management practice w/ climate-dependent impact according to Ogle (2005) – NB this does not include manure, residue and compost incorporation, which are modelled using an estimated annual increment from Smith (1997) in FIXME reference
- class Category(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.ManagementPracticeChange(*args, **kwargs)
Bases:
django.db.models.base.Model
Refactored to capture a change to or from a forest land management practice.
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.ManagementPracticeChangeImpact(*args, **kwargs)
Bases:
coolfarmtool.mixins.LastUpdatedMixin
Impact of a change from one :class:ManagementPractice to another
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.ManagementPracticeChangeInstance(*args, **kwargs)
Bases:
django.db.models.base.Model
A change from one
ManagementPractice
to another for a specificCropProduct
For organic input changes (only “started adding” is supported at present),
increment_factor
stores the calculated annual increment factor, which is looked up fromManagementPracticeChange.ratio
for other types of change- exception DoesNotExist
- exception MultipleObjectsReturned
- allocation
Percentage of the field in which this change was made
- years_ago
Number of years ago the change was made
- class crop.models.MonthPeriods(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class crop.models.NitrogenDeposition(id, latitude, longitude, n_dep)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.PaddyRegionFactor(*args, **kwargs)
Bases:
django.db.models.base.Model
A model to store Region specific factors for EF c
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.PesticideApplication(id, application_number, growing_area, percentage_rate, category, pesticide_type, application_rate_value, application_rate_unit)
Bases:
django.db.models.base.Model
- class Category(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- exception DoesNotExist
- exception MultipleObjectsReturned
- factor
return PesticideEmissionFactor for pesticide
- weighted_application_rate
Return the application rate weighted with the percentage of active ingredient.
- class crop.models.PesticideEmissionFactor(id, crop_type, pesticide, factor)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.PesticideType(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class crop.models.Processing(*args, **kwargs)
Bases:
farm.models.LabelMixin
,django.db.models.base.Model
A washing or grading operation for a specified
CropProduct
Warning
Only potatoes are supported at present
- exception DoesNotExist
- exception MultipleObjectsReturned
- class Type(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- allocation
Percentage of the crop processed
- property emissions
Calculated CO2 emissions from this processing operation, in kg CO2e
- property energy_use
Calculated energy for this processing operation, in kWh
- power_source
Energy source for this processing operation, as a
django.db.models.ForeignKey
tofactor.models.Factor
- product
Relevant
CropProduct
- class crop.models.ResidueManagementType(*args, **kwargs)
Bases:
django.db.models.base.Model
Crop residue management method, e.g. “Exported off farm”
- exception DoesNotExist
- exception MultipleObjectsReturned
- ch4_factor
CH4 emissions factor
- n2o_factor
N2O emissions factor
- class crop.models.SimpleCropProduct(id, name, pesticide_applications, applied_nitrogen, applied_phospohorous, applied_potassium, _product_dry)
Bases:
factor.models.EmissionsModel
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.SoilOrganicCarbonManagementPracticeChange(*args, **kwargs)
Bases:
django.db.models.base.Model
Change in SOC due to management practices
- exception DoesNotExist
- exception MultipleObjectsReturned
- get_farm_climate()
Get farm climate from CropProduct
- has_forest_change()
Check if the change is a forest change
- class crop.models.Storage(*args, **kwargs)
Bases:
factor.models.EmissionsModel
Storage and temperature control of and sprout suppressant application to a specified
CropProduct
Warning
Only potatoes are supported at present
- exception DoesNotExist
- exception MultipleObjectsReturned
- property _emissions_loading
Calculated CO2 emissions from loading fresh product into storage, in kg CO2e
- property _emissions_sprout_suppression
Calculated CO2 emissions from CIPC application for sprout suppression, in kg CO2e
Includes contributions from embedded energy, fogging and fanning; see Haverkort & Hillier (2011)
- property _emissions_temperature_control
Calculated CO2 emissions for cooling, heating and ventilation, in kg CO2e
- property _emissions_unloading
Calculated CO2 emissions from unloading finished (dry) product from storage, in kg CO2e
- cipc_application
Number of sprout suppressing (CIPC fogging) treatments
- cipc_dose
Sprout suppressant dose per treatment, in grams CIPC per tonne of product
- property energy_use_temperature_control
Calculated enery use for cooling, heating and ventilation, in kWh
Warning
This model was developed for the potato version, and may not be valid for other crop types.
- product
Relevant
CropProduct
- storage
Energy source for temperature control
- store_loading
Energy source for mechanised loading into storage
- stored_allocation
Percentage stored
- temperature = <quantity.models.QuantityField: temperature>
Difference from ambient temperature maintained with climate control
- time = <quantity.models.QuantityField: time>
Average time spent in storage
- unloading
Energy source for mechanised unloading from storage
- class crop.models.Tillage(id, name_key, name, order)
Bases:
crop.models.AbstractLookupElement
- exception DoesNotExist
- exception MultipleObjectsReturned
- save(*args, **kwargs) None
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- class crop.models.TillageLookup(id, climate_zone, tillage, factor)
Bases:
crop.models.AbstractSoilOrganicCarbonLookup
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.TreeBiomass(id, product, tree_type, density_last_year_value, density_last_year_unit, size_last_year_value, size_last_year_unit, size_this_year_value, size_this_year_unit, num_trees_delta_value, num_trees_delta_unit)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- property c_change_above
Change (vs. last year) in CO2-C sequestered above-ground
- Returns
Quantity
('kg CO2-C')
- property c_change_below
Change (vs. last year) in CO2-C sequestered below-ground
- Returns
Quantity
('kg CO2-C')
- c_total_above(size_year)
Total CO2-C sequestered above-ground
- c_total_below(size_year)
Total CO2-C sequestered below-ground
Warning
This is not currently used (cumulative totals are not displayed)
- Returns
Quantity
('kg CO2-C')
- property emissions
Calculated overall change (vs. last year) in sequestered CO2
- Returns
Quantity
('kg CO2e')
- tree_biomass(size=None)
Calculate biomass for a given tree size
- class crop.models.TreeType(id, constant, dbh, dbh_y_multiplier, shoot_ratio, carbon_fraction, wood_density, size_type, dbh_y_power, name)
Bases:
crop.models.BaseTreeType
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.TreeTypeVersion(id, creation_date, last_updated, constant, dbh, dbh_y_multiplier, shoot_ratio, carbon_fraction, wood_density, size_type, dbh_y_power, tree_type, version)
Bases:
coolfarmtool.mixins.LastUpdatedMixin
,crop.models.BaseTreeType
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.WaterCropProduct(*args, **kwargs)
Bases:
crop.models.BaseCropProduct
Single rotation of a
CropType
, water metric only- exception DoesNotExist
- exception MultipleObjectsReturned
- growing_area
Field (
GrowingArea
) on which this crop was grown
- class crop.models.WaterGrowingArea(id, label, soil_moisture_sowing, soil_type, farm)
Bases:
crop.models.BaseGrowingArea
- exception DoesNotExist
- exception MultipleObjectsReturned
- class crop.models.WaterIrrigationEvent(id, area_irrigated, water_source, has_source_pump, water_added_value, water_added_unit, product)
Bases:
crop.models.BaseIrrigationEvent
- exception DoesNotExist
- exception MultipleObjectsReturned
- crop.models.append_emissions_per_unit_and_area(e_dict, crop_product)
Appends per unit and per area emissions to dictionary of emissions
- Args:
e_dict: Dictionary of emissions crop_product: Crop product object
Returns: Updated dictionary of emissions
- crop.models.get_by_id_or_attribute(data, key, _class, attribute='name', required=True)
Look up object from data, based on a key, by attribute or ID
- Parameters
data (
dict
) –key (
str
) –attribute (
bool
) –required – whether to raise an error if an object can’t be located
crop.summary_views module
- class crop.summary_views.CropProductSummaryCompare(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,farm.views.SummaryCompareMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.CropProductSummaryCosts(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,farm.views.SummaryCostsMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_items_expenditure()
Return a list of (section_key, name, [items]). See “get_product_income”, above, for return full definition.
- class crop.summary_views.CropProductSummaryData(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.CropProductSummaryGHGs(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,django.views.generic.detail.DetailView
- form_class
alias of
crop.forms.DatasetForm
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.CropProductSummaryMore(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.CropProductSummaryPerformance(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
Bases:
crop.summary_views.CropSummaryMixin
,farm.views.SummaryShareMixin
,django.views.generic.detail.DetailView
- class crop.summary_views.CropProductSummaryWaste(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.CropProductSummaryWater(**kwargs)
Bases:
crop.summary_views.CropSummaryMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.CropSummaryMixin
Bases:
crop.views.CropProductMixin
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.WaterCropProductSummaryMore(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.summary_views.WaterCropProductSummaryWater(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,django.views.generic.detail.DetailView
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
crop.views module
- class crop.views.CloseCropProductMixin
Bases:
crop.views.CropProductMixin
- class crop.views.CropProductBatchImportCompleteView(**kwargs)
Bases:
farm.views.FarmMixin
,django.views.generic.base.TemplateView
- class crop.views.CropProductBatchImportView(**kwargs)
Bases:
farm.views.FarmMixin
,django.views.generic.edit.FormView
- form_class
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- class crop.views.CropProductCloseView(**kwargs)
Bases:
farm.views.ProductCloseViewMixin
,crop.views.CropProductMixin
,django.views.generic.detail.SingleObjectMixin
,django.views.generic.base.View
- get_success_url()
Return the URL to redirect to after closing the product.
- class crop.views.CropProductDetailView(**kwargs)
Bases:
farm.views.FarmMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- get_object(queryset=None)
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- model
alias of
crop.models.CropProduct
- class crop.views.CropProductEnergyProcessingView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“”Fuel & Energy” page
- form_class
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.CropProductEnergyProcessingForm'>)
Return an instance of the form to be used in this view.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_object(queryset=None)
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.CropProductExportView(**kwargs)
Bases:
crop.views.CropProductMixin
,farm.views.ProductExportView
- _for_footprinter(request, *args, **kwargs)
Footprinter export, unused
- class crop.views.CropProductFromFSAView(**kwargs)
Bases:
farm.views.FarmMixin
,django.views.generic.edit.FormView
Collect missing information to create a
CropProduct
from SAI FSAThe SAI Platform FSA tool provides crop type, growing area size & finished product amount; users need to provide crop name and soil properties
- form_class
alias of
crop.forms.FromFSAForm
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- class crop.views.CropProductGeneralView(**kwargs)
Bases:
farm.views.ProductCreationMixin
,crop.views.CloseCropProductMixin
,farm.views.ProductEditMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.CreateView
,django.views.generic.edit.UpdateView
- form_class
alias of
crop.forms.CropProductForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.CropProductForm'>)
Set
self.co_product_formset
- get_object(queryset=None)
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- model
alias of
crop.models.CropProduct
- class crop.views.CropProductJsonExportView(**kwargs)
Bases:
crop.views.CropProductMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
crop.models.CropProduct
- class crop.views.CropProductJsonResultsExportView(**kwargs)
Bases:
crop.views.CropProductMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
crop.models.CropProduct
- class crop.views.CropProductManagementView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“Carbon” page: practice changes, tree biomass
- form_class
- form_valid(form: crop.forms.CropProductSOCTreeBiomassForm)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.CropProductSOCTreeBiomassForm'>)
Return an instance of the form to be used in this view.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.CropProductMixin
Bases:
farm.views.FarmMixin
Pull crop product from the URL
TODO: redirect to create instead of 404
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- model
alias of
crop.models.CropProduct
- class crop.views.CropProductOnFarmView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“”On-farm operations” page
- form_class
alias of
waste.forms.CropProductOnFarmForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'waste.forms.CropProductOnFarmForm'>)
Return an instance of the form to be used in this view.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.CropProductPostFarmView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“”On-farm operations” page
- form_class
alias of
waste.forms.CropProductPostFarmForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'waste.forms.CropProductPostFarmForm'>)
Return an instance of the form to be used in this view.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.CropProductSaveAsView(**kwargs)
Bases:
crop.views.CropProductMixin
,farm.views.ProductSaveAsView
- class crop.views.CropProductTransportView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“Transport” page
- form_class
alias of
crop.forms.CropProductTransportForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.CropProductTransportForm'>)
Return an instance of the form to be used in this view.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.CropProductTreatmentView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“Inputs” page: fertilisers & pesticides
- form_class
alias of
crop.forms.CropProductTreatmentForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.CropProductTreatmentForm'>)
Return an instance of the form to be used in this view.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.CropProductVerificationView(**kwargs)
Bases:
crop.views.CropProductMixin
,django.views.generic.detail.SingleObjectMixin
,django.views.generic.base.View
- class crop.views.CropProductWaterView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
“”Irrigation” page
- form_class
alias of
crop.forms.CropProductWaterForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.CropProductWaterForm'>)
Return an instance of the form to be used in this view.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.GrowingAreaDetailView(**kwargs)
Bases:
farm.views.FarmMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- get_object(queryset=None)
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- model
alias of
crop.models.GrowingArea
- class crop.views.GrowingAreaView(**kwargs)
Bases:
crop.views.CloseCropProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.CreateView
,django.views.generic.edit.UpdateView
- form_class
alias of
crop.forms.GrowingAreaForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_object(queryset=None)
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- model
alias of
crop.models.GrowingArea
- class crop.views.TreeTypeDetailView(**kwargs)
Bases:
farm.views.FarmMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
crop.models.TreeType
- class crop.views.WaterCropProductExportView(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,farm.views.ProductExportView
- class crop.views.WaterCropProductJsonExportView(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
crop.models.WaterCropProduct
- class crop.views.WaterCropProductMixin
Bases:
farm.views.FarmMixin
Pull crop product from the URL
TODO: redirect to create instead of 404
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- model
alias of
crop.models.WaterCropProduct
- class crop.views.WaterCropProductSaveAsView(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,farm.views.ProductSaveAsView
- class crop.views.WaterCropProductView(**kwargs)
Bases:
crop.views.CropProductGeneralView
“General information” page for water-only assessments
- form_class
alias of
crop.forms.WaterCropProductForm
- form_valid(form)
If the form is valid, save the associated model.
- get_form(form_class=<class 'crop.forms.WaterCropProductForm'>)
Need to override to ensure WaterCropProductForm is used
- get_success_url()
Return the URL to redirect to after processing a valid form.
- model
alias of
crop.models.WaterCropProduct
- class crop.views.WaterCropProductWaterView(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,crop.views.GrowingAreaRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
- form_class
alias of
crop.forms.WaterCropProductWaterForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form(form_class=<class 'crop.forms.WaterCropProductWaterForm'>)
Return an instance of the form to be used in this view.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class crop.views.WaterGrowingAreaView(**kwargs)
Bases:
crop.views.WaterCropProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.CreateView
,django.views.generic.edit.UpdateView
- form_class
alias of
crop.forms.WaterGrowingAreaForm
- form_valid(form)
If the form is valid, save the associated model.
- get_context_data(**kwargs)
overidden get_context_data to inject a custom form onto certain page contexts in order to allow dynamic fields when using the save as feature e.g. dairy product and crop product would have different forms but this saves us having to create two forms just for the sake of one field
we only use this form on GET because the POST is managed by the ProductSaveAsView
- Returns
dictionary of keyword arguements
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_object(queryset=None)
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- model
alias of
crop.models.WaterGrowingArea