aggregation package
aggregation.forms module
- class aggregation.forms.AggFolderForm(*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 aggregation.forms.AggregationReportForm(*args, **kwargs)
Bases:
floppyforms.forms.Form
- class ReportTypes(filter=(<object object>, ), item=<object object>, grouped=False)
Bases:
dj.choices.Choices
- property media
Return all media required to render the widgets on this form.
Bases:
floppyforms.forms.Form
Return all media required to render the widgets on this form.
aggregation.models module
- class aggregation.models.AggFolder(*args, **kwargs)
Bases:
mptt.models.MPTTModel
AggFolder model creates a folder structure for aggregation report. It uses the tree data structure.
Warning: agg_group and parent should be exclusive. e.g if agg_group is not set to null then parent should be set to null.
- exception DoesNotExist
- exception MultipleObjectsReturned
- _mptt_tracking_base
alias of
aggregation.models.AggFolder
- aggregation_group
Returns the aggregation group for root aggregation folder. Because root aggregation folder connected to aggregation group.
- folder_products
Returns the products from aggregation folder
- folder_products_recursively
Returns the products from aggregation folder and its sub folders
- is_empty
Return True if the folder and its sub-folders don’t contain products, or False otherwise.
- classmethod is_name_taken(agg_group, parent, name)
Checks that aggregation folder name is taken already or not.
- print_path(include_self=False)
Returns a full path all of the tree.
- class aggregation.models.AggFolderSettings(*args, **kwargs)
Bases:
django.db.models.base.Model
AggFolderSettings model defines aggregation folder structure settings.
- exception DoesNotExist
- exception MultipleObjectsReturned
- class aggregation.models.AggGroup(*args, **kwargs)
Bases:
django.db.models.base.Model
AggGroup provides aggregation report for assessments.
- exception DoesNotExist
- exception MultipleObjectsReturned
- folders
Returns all the aggregation folders
- group_products
Returns the products from an aggregation group which do not belong to a folder within the group
- root_folders
Returns the root aggregation folders
aggregation.views module
- class aggregation.views.AggFolderCreateView(**kwargs)
Bases:
aggregation.mixins.AggGroupMixin
,django.views.generic.base.View
- form_class
alias of
aggregation.forms.AggFolderForm
- class aggregation.views.AggFolderDeleteView(**kwargs)
Bases:
aggregation.mixins.AggFolderPermissionMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.edit.DeleteView
- delete(request, *args, **kwargs)
Call the delete() method on the fetched object and then redirect to the success URL.
- model
alias of
aggregation.models.AggFolder
- class aggregation.views.AggFolderProductListView(**kwargs)
Bases:
braces.views._access.LoginRequiredMixin
,django.views.generic.detail.SingleObjectMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.base.View
- model
alias of
aggregation.models.AggFolder
- class aggregation.views.AggFolderProductUpdateView(**kwargs)
Bases:
braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.SingleObjectMixin
,farm.views.AjaxResponseMixin
,django.views.generic.base.View
- model
alias of
farm.models.Product
- class aggregation.views.AggFolderUpdateView(**kwargs)
Bases:
aggregation.mixins.AggGroupMixin
,django.views.generic.detail.SingleObjectMixin
,django.views.generic.base.View
- form_class
alias of
aggregation.forms.AggFolderForm
- model
alias of
aggregation.models.AggFolder
- class aggregation.views.AggGroupDetailView(**kwargs)
Bases:
braces.views._access.LoginRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.detail.DetailView
- model
alias of
aggregation.models.AggGroup
- class aggregation.views.AggGroupProductListView(**kwargs)
Bases:
braces.views._access.LoginRequiredMixin
,django.views.generic.detail.SingleObjectMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.base.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
aggregation.models.AggGroup
- class aggregation.views.AggProductActionsView(**kwargs)
Bases:
braces.views._access.LoginRequiredMixin
,farm.views.AjaxResponseMixin
,braces.views._ajax.JSONResponseMixin
,django.views.generic.base.View
- class aggregation.views.AggregationView(**kwargs)
Bases:
braces.views._access.LoginRequiredMixin
,django.views.generic.edit.FormView
- static _pesticide_inputs_collated(product, new_format=False)
Return the pesticide collated inputs
Although deprecated, the old pesticide format is kept as it was in the report to maintain the current structure of the report and a new format is added at the end for seed and post applications pesticides.
It is intended to remove the old format as part of a CFT major relase.
- form_class
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get(request, *args, **kwargs)
Handle GET requests: instantiate a blank version of the form.
- get_context_data(**kwargs)
Insert the form into the context dict.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- get_tree_data()
Returns a data folder structure to be used with gijgo plugin
https://gijgo.com/tree/demos/bootstrap-4-treeview
e.g [
{‘text’: ‘folder_1’, children: [{text: ‘folder_2A’}]}, {‘text’: ‘folder_2’, children: [{text: ‘folder_2A’},
{text: ‘folder_2B’}]},
- {
‘text’: ‘folder_3’, ‘children’: [{text: ‘folder_2A’,
children: [{text:, ‘folder_3A’}]}, {text: ‘folder_2B’}]
},
]
- setup(request, *args, **kwargs)
Initialize attributes shared by all view methods.
Bases:
braces.views._access.LoginRequiredMixin
,django.views.generic.detail.SingleObjectMixin
,braces.views._ajax.JSONResponseMixin
,farm.views.AjaxResponseMixin
,django.views.generic.edit.FormView
Make request.is_ajax return True if “ajax” is given in GET
Return a dict of
form.errors
If the form is valid, redirect to the supplied URL.
Handle GET requests: instantiate a blank version of the form.
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.
alias of
farm.models.Product
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
Bases:
aggregation.views.ShareView
If the form is valid, redirect to the supplied URL.
- aggregation.views.len_sections(sections)
This function return that Args:
sections:
Returns: