livestock package
livestock.forms module
- class livestock.forms.FeedEstimateJuvenileForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- class livestock.forms.FeedEstimateProductiveForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- class livestock.forms.LivestockFeedForm(*args, **kwargs)
Bases:
floppyforms.__future__.models.ModelForm
- property media
Return all media required to render the widgets on this form.
- class livestock.forms.LivestockHerdSectionForm(*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 livestock.forms.LivestockProductEnergyProcessingForm(*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 livestock.forms.LivestockProductForm(*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(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 livestock.forms.LivestockProductHerdFeedForm(*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 livestock.forms.LivestockProductTransportForm(*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.
livestock.models module
- class livestock.models.FeedEstimate(id, product, phase, number_females, fat_content, protein_content, percentage_pregnant, start_weight_value, start_weight_unit, adult_male_weight_value, adult_male_weight_unit, adult_female_weight_value, adult_female_weight_unit, milk_production_value, milk_production_unit)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.HerdSection(id, product, phase, animals, has_grazing, grazing_percentage, grazing_quality, grazing_type, phase_length_value, phase_length_unit, dry_matter_intake_value, dry_matter_intake_unit)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- class GrazingQuality(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class GrazingType(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- exception MultipleObjectsReturned
- clean()
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- property feed_consumption
Calculate the total feed consumed during this life-cycle phase
- class livestock.models.LifePhase(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- class livestock.models.LivestockData(*args, **kwargs)
Bases:
django.db.models.base.Model
Link data to LivestockType, optionally per-LifePhase
- class livestock.models.LivestockExcretion(*args, **kwargs)
Bases:
livestock.models.LivestockData
N excretion rates per continent and per LivestockType or LifePhase
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.LivestockFeed(id, herd_section, crop_product, simple_crop_product, percentage)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.LivestockPhysicalProperties(id, livestock_type, phase, continent, heavily_industrialised, mass_per_animal, b_0, vs, enteric_factor)
Bases:
livestock.models.LivestockData
- exception DoesNotExist
- exception MultipleObjectsReturned
- clean()
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- class livestock.models.LivestockProduct(id, creation_date, last_updated, slug, farm, reporting_year, name, has_co_products, has_waste_water, oxygen_demand_type, water_treatment_type, comments, cost_data, result_output, is_closed, verification_status, product_dry_value, product_dry_unit, waste_water_production_value, waste_water_production_unit, oxygen_demand_value, oxygen_demand_unit, product_ptr, livestock_type, variety, livestock_progress, evaluation_method)
Bases:
farm.models.Product
- exception DoesNotExist
- class EvaluationMethod(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- exception MultipleObjectsReturned
- class livestock.models.LivestockType(id, name, description, has_dmi_equation, factor_grazing)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.LivestockVariety(*args, **kwargs)
Bases:
django.db.models.base.Model
Named sub-species of a LivestockType (e.g. “Commercial Brown”)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.ManureManagement(id, type, allocation, herd_section, days_per_year)
Bases:
livestock.models.BaseManureManagement
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.ManureManagementType(id, name, direct_n2o, hidden)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.ManureMethaneConversionFactor(id, climate_zone, manure_management)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.ManureMethaneConversionFactorVersion(id, conversion_factor, version, factor)
Bases:
django.db.models.base.Model
- exception DoesNotExist
- exception MultipleObjectsReturned
- class livestock.models.ManureVolatilisation(id, livestock_type, phase, percentage_n_loss, manure_management)
Bases:
livestock.models.LivestockData
- exception DoesNotExist
- exception MultipleObjectsReturned
livestock.views module
- class livestock.views.LivestockProductCreateView(**kwargs)
Bases:
farm.views.FarmMixin
,farm.views.ProductCreationMixin
,farm.views.ProductEditMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.CreateView
“General informtion” page
- dispatch(request, *args, **kwargs)
Make request.is_ajax return True if “ajax” is given in GET
- form_class
alias of
livestock.forms.LivestockProductForm
- 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 'livestock.forms.LivestockProductForm'>)
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
livestock.models.LivestockProduct
- class livestock.views.LivestockProductDetailView(**kwargs)
Bases:
farm.views.FarmMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
livestock.models.LivestockProduct
- class livestock.views.LivestockProductEnergyProcessingView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
- form_class
alias of
livestock.forms.LivestockProductEnergyProcessingForm
- 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 'livestock.forms.LivestockProductEnergyProcessingForm'>)
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 livestock.views.LivestockProductExportView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.ProductExportView
- class livestock.views.LivestockProductFeedEstimateView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
- dispatch(request, *args, **kwargs)
Make request.is_ajax return True if “ajax” is given in GET
- 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_class()
Return the form class to use in this view.
- 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
livestock.models.FeedEstimate
- class livestock.views.LivestockProductHerdFeedView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
- 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 'livestock.forms.LivestockProductHerdFeedForm'>)
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 livestock.views.LivestockProductMixin
Bases:
farm.views.FarmMixin
Pull livestock 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
livestock.models.LivestockProduct
- class livestock.views.LivestockProductPartialDetailView(**kwargs)
Bases:
farm.views.FarmMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
livestock.models.LivestockProduct
- class livestock.views.LivestockProductSaveAsView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,django.views.generic.detail.SingleObjectMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.base.View
- class livestock.views.LivestockProductSummaryView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
Crop product summary page; can be called via AJAX for results
- get_ajax(request, *args, **kwargs)
Return JSON dict of calculation results
- 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
livestock.models.LivestockProduct
- class livestock.views.LivestockProductTransportView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
- 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 'livestock.forms.LivestockProductTransportForm'>)
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 livestock.views.LivestockProductUpdateView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,farm.views.ProductEditMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.UpdateView
- form_class
alias of
livestock.forms.LivestockProductForm
- form_valid(form)
If the form is valid, save the associated model.
- get_success_url()
Return the URL to redirect to after processing a valid form.
- class livestock.views.LivestockSummaryCompare(**kwargs)
Bases:
livestock.views.LivestockSummaryMixin
,farm.views.SummaryCompareMixin
,django.views.generic.detail.DetailView
- class livestock.views.LivestockSummaryCosts(**kwargs)
Bases:
livestock.views.LivestockSummaryMixin
,farm.views.SummaryCostsMixin
,django.views.generic.detail.DetailView
- get_items_expenditure()
Return a list of (section_key, name, [items]). See “get_product_income”, above, for return full definition.
- class livestock.views.LivestockSummaryData(**kwargs)
Bases:
livestock.views.LivestockSummaryMixin
,django.views.generic.detail.DetailView
- class livestock.views.LivestockSummaryGHGs(**kwargs)
Bases:
livestock.views.LivestockSummaryMixin
,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 livestock.views.LivestockSummaryMixin
Bases:
livestock.views.LivestockProductMixin
- 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 livestock.views.LivestockSummaryMore(**kwargs)
Bases:
livestock.views.LivestockSummaryMixin
,django.views.generic.detail.DetailView
- class livestock.views.LivestockSummaryPerformance(**kwargs)
Bases:
livestock.views.LivestockSummaryMixin
,django.views.generic.detail.DetailView
Bases:
livestock.views.LivestockSummaryMixin
,django.views.generic.detail.DetailView
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 livestock.views.OtherLivestockCalculateJSONExportView(**kwargs)
Bases:
braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
livestock.models.LivestockProduct
- class livestock.views.OtherLivestockProductResultsJsonExportView(**kwargs)
Bases:
livestock.views.LivestockProductMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
livestock.models.LivestockProduct