api package

api.models module

class api.models.ApiLogging(id, app_key, app_name, app_owner_name, app_owner_email, api_key, user_username, user_first_name, user_last_name, user_email, user_country, user_territory, user_organisation, api_datetime, cft_version, status_code, endpoint_url, http_method, server, pathway, assessment_number)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class api.models.Application(id, name, owner, active, api_key)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

save(*args, **kwargs)

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 api.models.LogAssessmentData(id, api_log, total_emissions, calculation_success, calculation_exception, country, territory, crop_type, field_size)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

api.v1.forms module

class api.v1.forms.ApiFertiliserApplicationForm(*args, **kwargs)

Bases: dairy.forms.FertiliserApplicationForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.CropProductCreateForm(*args, **kwargs)

Bases: django.forms.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 api.v1.forms.FeedAdditiveDoseAPIForm(*args, **kwargs)

Bases: cattle.forms.BaseCattleFeedAdditiveDoseForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.FeedComponentForm1(*args, **kwargs)

Bases: cattle.forms.FeedComponentForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.FertiliserCalculateForm(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, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

property media

Return all media required to render the widgets on this form.

class api.v1.forms.GrazingSectionForm(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: django.forms.models.ModelForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.IrrigationCalculateForm(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, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

property media

Return all media required to render the widgets on this form.

class api.v1.forms.ManureManagementForm(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: django.forms.models.ModelForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.UserAPIKeyForm(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, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

property media

Return all media required to render the widgets on this form.

api.v1.views module

class api.v1.views.APIDemoView(**kwargs)

Bases: django.contrib.auth.mixins.LoginRequiredMixin, api.v1.mixins.LoggingAPIMixin, django.views.generic.base.TemplateView

class api.v1.views.CountryResource(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView, rest_framework.generics.RetrieveAPIView

serializer_class

alias of api.v1.serializers.ExtendedCountrySerialiser

class api.v1.views.CropProductCreateView(**kwargs)

Bases: api.v1.mixins.APIKeyMixin, api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.GenericAPIView

“Create GHG footprint”

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

form_class

alias of api.v1.forms.CropProductCreateForm

class api.v1.views.CropTypeView(**kwargs)

Bases: api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of api.v1.serializers.CropTypeSerialiser

class api.v1.views.EnergyListResource(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of api.v1.serializers.EnergyListSerialiser

class api.v1.views.FertiliserCalculateView(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.GenericAPIView

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

form_class

alias of api.v1.forms.FertiliserCalculateForm

class api.v1.views.FertiliserTypeView(**kwargs)

Bases: api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

serializer_class

alias of api.v1.serializers.FertiliserTypeSerialiser

class api.v1.views.FindMachineCategoryView(**kwargs)

Bases: rest_framework.generics.RetrieveAPIView

class ProductResource(**kwargs)

Bases: api.v1.mixins.APIKeyMixin, api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.RetrieveAPIView

model

alias of farm.models.Product

serializer_class

alias of api.v1.serializers.ProductSerialiser

filter_queryset(queryset)

Given a queryset, filter it with whichever filter backend is in use.

You are unlikely to want to override this method, although you may need to call it either from a list view, or from a custom get_object method if you want to apply the configured filtering backend to the default queryset.

serializer_class

alias of api.v1.serializers.FindMachineCategorySerialiser

class api.v1.views.IrrigationCalculateView(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.GenericAPIView

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

form_class

alias of api.v1.forms.IrrigationCalculateForm

class api.v1.views.MachineTypeView(**kwargs)

Bases: rest_framework.generics.ListAPIView, rest_framework.generics.RetrieveAPIView

filter_queryset(queryset)

Given a queryset, filter it with whichever filter backend is in use.

You are unlikely to want to override this method, although you may need to call it either from a list view, or from a custom get_object method if you want to apply the configured filtering backend to the default queryset.

serializer_class

alias of api.v1.serializers.MachineTypeSerialiser

class api.v1.views.PingView(**kwargs)

Bases: api.v1.mixins.APIMixin, rest_framework.views.APIView

class api.v1.views.ProductResource(**kwargs)

Bases: api.v1.mixins.APIKeyMixin, api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.RetrieveAPIView

model

alias of farm.models.Product

serializer_class

alias of api.v1.serializers.ProductSerialiser

class api.v1.views.ProductToFSAView(**kwargs)

Bases: farm.views.FarmMixin, rest_framework.generics.GenericAPIView

class api.v1.views.UnitView(**kwargs)

Bases: api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

serializer_class

alias of api.v1.serializers.UnitSerialiser

class api.v1.views.UserAPIKeyView(**kwargs)

Bases: rest_framework.generics.RetrieveAPIView, api.v1.mixins.APIMixin

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

class api.v1.views.UserView(**kwargs)

Bases: rest_framework.generics.ListAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of api.v1.serializers.UserSerialiser

api.v1.calculations module

class api.v1.forms.ApiFertiliserApplicationForm(*args, **kwargs)

Bases: dairy.forms.FertiliserApplicationForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.CropProductCreateForm(*args, **kwargs)

Bases: django.forms.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 api.v1.forms.FeedAdditiveDoseAPIForm(*args, **kwargs)

Bases: cattle.forms.BaseCattleFeedAdditiveDoseForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.FeedComponentForm1(*args, **kwargs)

Bases: cattle.forms.FeedComponentForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.FertiliserCalculateForm(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, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

property media

Return all media required to render the widgets on this form.

class api.v1.forms.GrazingSectionForm(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: django.forms.models.ModelForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.IrrigationCalculateForm(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, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

property media

Return all media required to render the widgets on this form.

class api.v1.forms.ManureManagementForm(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: django.forms.models.ModelForm

property media

Return all media required to render the widgets on this form.

class api.v1.forms.UserAPIKeyForm(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, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

property media

Return all media required to render the widgets on this form.

api.v1.resources module

class api.v1.views.APIDemoView(**kwargs)

Bases: django.contrib.auth.mixins.LoginRequiredMixin, api.v1.mixins.LoggingAPIMixin, django.views.generic.base.TemplateView

class api.v1.views.CountryResource(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView, rest_framework.generics.RetrieveAPIView

serializer_class

alias of api.v1.serializers.ExtendedCountrySerialiser

class api.v1.views.CropProductCreateView(**kwargs)

Bases: api.v1.mixins.APIKeyMixin, api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.GenericAPIView

“Create GHG footprint”

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

form_class

alias of api.v1.forms.CropProductCreateForm

class api.v1.views.CropTypeView(**kwargs)

Bases: api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of api.v1.serializers.CropTypeSerialiser

class api.v1.views.EnergyListResource(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of api.v1.serializers.EnergyListSerialiser

class api.v1.views.FertiliserCalculateView(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.GenericAPIView

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

form_class

alias of api.v1.forms.FertiliserCalculateForm

class api.v1.views.FertiliserTypeView(**kwargs)

Bases: api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

serializer_class

alias of api.v1.serializers.FertiliserTypeSerialiser

class api.v1.views.FindMachineCategoryView(**kwargs)

Bases: rest_framework.generics.RetrieveAPIView

class ProductResource(**kwargs)

Bases: api.v1.mixins.APIKeyMixin, api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.RetrieveAPIView

model

alias of farm.models.Product

serializer_class

alias of api.v1.serializers.ProductSerialiser

filter_queryset(queryset)

Given a queryset, filter it with whichever filter backend is in use.

You are unlikely to want to override this method, although you may need to call it either from a list view, or from a custom get_object method if you want to apply the configured filtering backend to the default queryset.

serializer_class

alias of api.v1.serializers.FindMachineCategorySerialiser

class api.v1.views.IrrigationCalculateView(**kwargs)

Bases: api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.GenericAPIView

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

form_class

alias of api.v1.forms.IrrigationCalculateForm

class api.v1.views.MachineTypeView(**kwargs)

Bases: rest_framework.generics.ListAPIView, rest_framework.generics.RetrieveAPIView

filter_queryset(queryset)

Given a queryset, filter it with whichever filter backend is in use.

You are unlikely to want to override this method, although you may need to call it either from a list view, or from a custom get_object method if you want to apply the configured filtering backend to the default queryset.

serializer_class

alias of api.v1.serializers.MachineTypeSerialiser

class api.v1.views.PingView(**kwargs)

Bases: api.v1.mixins.APIMixin, rest_framework.views.APIView

class api.v1.views.ProductResource(**kwargs)

Bases: api.v1.mixins.APIKeyMixin, api.v1.mixins.APIMixin, api.v1.mixins.LoggingAPIMixin, rest_framework.generics.RetrieveAPIView

model

alias of farm.models.Product

serializer_class

alias of api.v1.serializers.ProductSerialiser

class api.v1.views.ProductToFSAView(**kwargs)

Bases: farm.views.FarmMixin, rest_framework.generics.GenericAPIView

class api.v1.views.UnitView(**kwargs)

Bases: api.v1.mixins.LoggingAPIMixin, rest_framework.generics.ListAPIView

serializer_class

alias of api.v1.serializers.UnitSerialiser

class api.v1.views.UserAPIKeyView(**kwargs)

Bases: rest_framework.generics.RetrieveAPIView, api.v1.mixins.APIMixin

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

class api.v1.views.UserView(**kwargs)

Bases: rest_framework.generics.ListAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of api.v1.serializers.UserSerialiser