4.2.1. fpiweb package

Subpackages

Submodules

fpiweb.admin module

Admin.py - Identify what can be managed by administrators.

class fpiweb.admin.ActivityAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('id', 'box_number', 'date_filled', 'date_consumed', 'adjustment_code')
list_filter = ('adjustment_code',)
property media
class fpiweb.admin.BoxAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('id', 'box_number', 'box_type', 'location', 'quantity', 'product')
list_filter = ('box_type',)
property media
class fpiweb.admin.BoxTypeAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('box_type_code', 'box_type_descr', 'box_type_qty')
property media
class fpiweb.admin.ConstraintsAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('constraint_name', 'constraint_type', 'constraint_min', 'constraint_max', 'constraint_list')
property media
class fpiweb.admin.LocBinAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('loc_bin', 'loc_bin_descr')
property media
class fpiweb.admin.LocRowAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('loc_row', 'loc_row_descr')
property media
class fpiweb.admin.LocTierAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('loc_tier', 'loc_tier_descr')
property media
class fpiweb.admin.Location(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('pk', 'loc_row', 'loc_bin', 'loc_tier')
list_filter = ('loc_row', 'loc_bin', 'loc_tier')
property media
class fpiweb.admin.PalletAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('pk', 'name')
property media
class fpiweb.admin.PalletBoxAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('box_number', 'pallet', 'box', 'product', 'exp_year', 'exp_month_start', 'exp_month_end')
property media
class fpiweb.admin.ProductAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('prod_name', 'prod_cat')
property media
class fpiweb.admin.ProfileAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('user', 'title', 'active_pallet_id')
property media

fpiweb.apps module

class fpiweb.apps.FpiwebConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

name = 'fpiweb'

fpiweb.code_reader module

exception fpiweb.code_reader.CodeReaderError[source]

Bases: RuntimeError

fpiweb.code_reader.delete_file(image_file_path)[source]
fpiweb.code_reader.get_scan_file_path()[source]
fpiweb.code_reader.read(scan_data)[source]
fpiweb.code_reader.read_box_number(scan_data)[source]

fpiweb.constants module

Global constants, constructs and exceptions for this project.

Constants and constructs that don’t have an obvious home elsewhere are defined here.

Non-Django-based exceptions are defined here.

fpiweb.constants.CURRENT_YEAR = 2021

The current year - used for validating expiration dates

exception fpiweb.constants.InternalError(message, code=None, params=None)[source]

Bases: fpiweb.constants.ProjectError

The error is raised when there is some interal logic problem.

exception fpiweb.constants.InvalidActionAttemptedError(message, code=None, params=None)[source]

Bases: fpiweb.constants.ProjectError

A requested action cannot be done at this time.

exception fpiweb.constants.InvalidValueError(message, code=None, params=None)[source]

Bases: fpiweb.constants.ProjectError

Used when an invalid value has been passed as a parameter.

exception fpiweb.constants.ProjectError(message, code=None, params=None)[source]

Bases: django.core.exceptions.ValidationError

All exceptions unique to this project wil be based on this class.

class fpiweb.constants.ValidOrErrorResponse(is_valid: bool = True, error_msg_list: List[str] = <factory>)[source]

Bases: object

A constructed response denoting either valid or has error messages.

add_error(msg: str)[source]

Set as invalid and add an error message.

Parameters

msg – error message to add

Returns

error_msg_list: List[str]
is_valid: bool = True

fpiweb.forms module

forms.py - provide validation of a forms.

class fpiweb.forms.BoxItemForm(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)[source]

Bases: django.forms.forms.Form

Form for the Box as it appears as part of a formset on the Build Pallet page

base_fields = {'box_number': <fpiweb.forms.BoxNumberField object>, 'exp_month_end': <django.forms.fields.IntegerField object>, 'exp_month_start': <django.forms.fields.IntegerField object>, 'exp_year': <django.forms.fields.TypedChoiceField object>, 'product': <django.forms.models.ModelChoiceField object>}
clean()[source]

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__’.

declared_fields = {'box_number': <fpiweb.forms.BoxNumberField object>, 'exp_month_end': <django.forms.fields.IntegerField object>, 'exp_month_start': <django.forms.fields.IntegerField object>, 'exp_year': <django.forms.fields.TypedChoiceField object>, 'product': <django.forms.models.ModelChoiceField object>}
static get_initial_from_box(box)[source]
Parameters

box – Box or PalletBox record

Returns

property media

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

class fpiweb.forms.BoxNumberField(**kwargs)[source]

Bases: django.forms.fields.CharField

class fpiweb.forms.BoxTypeForm(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)[source]

Bases: django.forms.forms.Form

A form to use whenever a box type selection is needed.

base_fields = {'box_type': <django.forms.models.ModelChoiceField object>}
declared_fields = {'box_type': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.BuildPalletForm(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)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('loc_row', 'loc_bin', 'loc_tier')
model

alias of fpiweb.models.Location

base_fields = {'loc_bin': <django.forms.models.ModelChoiceField object>, 'loc_row': <django.forms.models.ModelChoiceField object>, 'loc_tier': <django.forms.models.ModelChoiceField object>}
clean()[source]

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__’.

declared_fields = {}
property media

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

class fpiweb.forms.ConfirmMergeForm(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)[source]

Bases: django.forms.forms.Form

ACTION_CHANGE_LOCATION = 'C'
ACTION_CHOICES = (('C', 'Change To Location'), ('M', 'Merge Pallets'))
ACTION_MERGE_PALLETS = 'M'
base_fields = {'action': <django.forms.fields.ChoiceField object>, 'boxes_at_to_location': <django.forms.fields.IntegerField object>, 'from_location': <django.forms.models.ModelChoiceField object>, 'to_location': <django.forms.models.ModelChoiceField object>}
boxes_at_to_location_int()[source]
declared_fields = {'action': <django.forms.fields.ChoiceField object>, 'boxes_at_to_location': <django.forms.fields.IntegerField object>, 'from_location': <django.forms.models.ModelChoiceField object>, 'to_location': <django.forms.models.ModelChoiceField object>}
property media

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

to_location_str()[source]
class fpiweb.forms.ConstraintsForm(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)[source]

Bases: django.forms.models.ModelForm

Manage Constraint details with a generic form.

class Meta[source]

Bases: object

Additional info to help Django provide intelligent defaults.

fields = ['id', 'constraint_name', 'constraint_descr', 'constraint_type', 'constraint_min', 'constraint_max', 'constraint_list']
model

alias of fpiweb.models.Constraints

base_fields = {'constraint_descr': <django.forms.fields.CharField object>, 'constraint_list': <django.forms.fields.CharField object>, 'constraint_max': <django.forms.fields.CharField object>, 'constraint_min': <django.forms.fields.CharField object>, 'constraint_name': <django.forms.fields.TypedChoiceField object>, 'constraint_type': <django.forms.fields.ChoiceField object>}
clean()[source]

Clean and validate the data given for the constraint record.

Returns

declared_fields = {'constraint_list': <django.forms.fields.CharField object>, 'constraint_max': <django.forms.fields.CharField object>, 'constraint_min': <django.forms.fields.CharField object>, 'constraint_type': <django.forms.fields.ChoiceField object>}
property media

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

static validate_constraint_fields(con_name: str, con_descr: str, con_type: ‘Int-MM’, ‘Integer Min/Max’, ‘Char-MM’, ‘Character Min/Max’, ‘Int-List’, ‘Integer Valid List’, ‘Char-List’, ‘Character Valid List’, con_min: Union[str, int], con_max: Union[str, int], con_list: str)[source]

Validate the various constraint record fields.

Parameters
  • con_name – name of constraint

  • con_type – type of constraint

  • con_min – minimum value, if given

  • con_max – maximum value, if given

  • con_list – list of values, if given

Returns

class fpiweb.forms.EmptyBoxNumberField(**kwargs)[source]

Bases: fpiweb.forms.ExtantBoxNumberField

Checks whether there’s a Box with the specified box number in the database. If a matching Box is found, this Box is stored in the field’s box attribute

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class fpiweb.forms.EmptyBoxNumberForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'box_number': <fpiweb.forms.EmptyBoxNumberField object>}
declared_fields = {'box_number': <fpiweb.forms.EmptyBoxNumberField object>}
property media

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

class fpiweb.forms.ExistingBoxTypeForm(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)[source]

Bases: fpiweb.forms.BoxTypeForm

A form to validate that the box type exists.

base_fields = {'box_type': <django.forms.models.ModelChoiceField object>}
clean()[source]

Validate the box type.

declared_fields = {'box_type': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.ExistingLocationForm(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)[source]

Bases: fpiweb.forms.LocationForm

base_fields = {'loc_bin': <django.forms.models.ModelChoiceField object>, 'loc_row': <django.forms.models.ModelChoiceField object>, 'loc_tier': <django.forms.models.ModelChoiceField object>}
clean()[source]

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__’.

declared_fields = {}
property media

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

class fpiweb.forms.ExistingLocationWithBoxesForm(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)[source]

Bases: fpiweb.forms.ExistingLocationForm

base_fields = {'loc_bin': <django.forms.models.ModelChoiceField object>, 'loc_row': <django.forms.models.ModelChoiceField object>, 'loc_tier': <django.forms.models.ModelChoiceField object>}
clean()[source]

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__’.

declared_fields = {}
property media

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

class fpiweb.forms.ExistingProductForm(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)[source]

Bases: fpiweb.forms.ProductForm

base_fields = {'product': <django.forms.models.ModelChoiceField object>}
clean()[source]

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__’.

declared_fields = {'product': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.ExpMoEndForm(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)[source]

Bases: django.forms.forms.Form

A form for use whenever you need to select an ending month.

base_fields = {'exp_month_end': <django.forms.fields.TypedChoiceField object>}
declared_fields = {'exp_month_end': <django.forms.fields.TypedChoiceField object>}
property media

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

valid_months = [(0, 'No Label'), ('1', 'Jan'), ('2', 'Feb'), ('3', 'Mar'), ('4', 'Apr'), ('5', 'May'), ('6', 'Jun'), ('7', 'Jul'), ('8', 'Aug'), ('9', 'Sep'), ('10', 'Oct'), ('11', 'Nov'), ('12', 'Dec')]
class fpiweb.forms.ExpMoStartForm(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)[source]

Bases: django.forms.forms.Form

A form for use whenever you need to select a starting month.

base_fields = {'exp_month_start': <django.forms.fields.TypedChoiceField object>}
declared_fields = {'exp_month_start': <django.forms.fields.TypedChoiceField object>}
property media

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

valid_months = [(0, 'No Label'), ('1', 'Jan'), ('2', 'Feb'), ('3', 'Mar'), ('4', 'Apr'), ('5', 'May'), ('6', 'Jun'), ('7', 'Jul'), ('8', 'Aug'), ('9', 'Sep'), ('10', 'Oct'), ('11', 'Nov'), ('12', 'Dec')]
class fpiweb.forms.ExpYearForm(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)[source]

Bases: django.forms.forms.Form

A form for use whenever you need to select a year.

base_fields = {'exp_year': <django.forms.fields.TypedChoiceField object>}
declared_fields = {'exp_year': <django.forms.fields.TypedChoiceField object>}
property media

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

class fpiweb.forms.ExtantBoxNumberField(**kwargs)[source]

Bases: fpiweb.forms.RelaxedBoxNumberField

Checks whether there’s a Box with the specified box number in the database. If a matching Box is found, this Box is stored in the field’s box attribute

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class fpiweb.forms.ExtantBoxNumberForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'box_number': <fpiweb.forms.ExtantBoxNumberField object>}
declared_fields = {'box_number': <fpiweb.forms.ExtantBoxNumberField object>}
property media

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

class fpiweb.forms.FillBoxForm(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)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ['product', 'exp_year', 'exp_month_start', 'exp_month_end']
model

alias of fpiweb.models.Box

base_fields = {'exp_month_end': <django.forms.fields.TypedChoiceField object>, 'exp_month_start': <django.forms.fields.TypedChoiceField object>, 'exp_year': <django.forms.fields.TypedChoiceField object>, 'product': <django.forms.models.ModelChoiceField object>}
clean()[source]

Clean and validate the data in this box record.

Returns

declared_fields = {'exp_month_end': <django.forms.fields.TypedChoiceField object>, 'exp_month_start': <django.forms.fields.TypedChoiceField object>, 'exp_year': <django.forms.fields.TypedChoiceField object>}
property media

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

class fpiweb.forms.FilledBoxNumberField(**kwargs)[source]

Bases: fpiweb.forms.ExtantBoxNumberField

Checks whether there’s a Box with the specified box number in the database. If a matching Box is found, this Box is stored in the field’s box attribute

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class fpiweb.forms.FilledBoxNumberForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'box_number': <fpiweb.forms.FilledBoxNumberField object>}
declared_fields = {'box_number': <fpiweb.forms.FilledBoxNumberField object>}
property media

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

class fpiweb.forms.HiddenPalletForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'pallet': <django.forms.models.ModelChoiceField object>}
declared_fields = {'pallet': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.Html5DateInput(attrs=None, format=None)[source]

Bases: django.forms.widgets.DateInput

input_type = 'date'
property media
class fpiweb.forms.LocBinForm(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)[source]

Bases: django.forms.models.ModelForm

Manage Loction bin details with a generic form.

class Meta[source]

Bases: object

Additional info to help Django provide intelligent defaults.

fields = ['id', 'loc_bin', 'loc_bin_descr']
model

alias of fpiweb.models.LocBin

base_fields = {'loc_bin': <django.forms.fields.CharField object>, 'loc_bin_descr': <django.forms.fields.CharField object>}
clean()[source]

Clean and validate the data given for the bin record.

Returns

declared_fields = {'loc_bin': <django.forms.fields.CharField object>}
property media

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

static validate_loc_bin_fields(loc_bin_name: str, loc_bin_descr: str)[source]

Validate the various location bin record fields.

Parameters
  • loc_bin_name – name of bin

  • loc_bin_descr – description of bin

Returns

True if valid

class fpiweb.forms.LocRowForm(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)[source]

Bases: django.forms.models.ModelForm

Manage Loction row details with a generic form.

class Meta[source]

Bases: object

Additional info to help Django provide intelligent defaults.

fields = ['id', 'loc_row', 'loc_row_descr']
model

alias of fpiweb.models.LocRow

base_fields = {'loc_row': <django.forms.fields.CharField object>, 'loc_row_descr': <django.forms.fields.CharField object>}
clean()[source]

Clean and validate the data given for the constraint record.

Returns

declared_fields = {'loc_row': <django.forms.fields.CharField object>}
property media

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

static validate_loc_row_fields(loc_row_name: str, loc_row_descr: str)[source]

Validate the various location row record fields.

Parameters
  • loc_row_name – name of row

  • loc_row_descr – description of row

Returns

True if valid

class fpiweb.forms.LocTierForm(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)[source]

Bases: django.forms.models.ModelForm

Manage Loction tier details with a generic form.

class Meta[source]

Bases: object

Additional info to help Django provide intelligent defaults.

fields = ['id', 'loc_tier', 'loc_tier_descr']
model

alias of fpiweb.models.LocTier

base_fields = {'loc_tier': <django.forms.fields.CharField object>, 'loc_tier_descr': <django.forms.fields.CharField object>}
clean()[source]

Clean and validate the data given for the tier record.

Returns

declared_fields = {'loc_tier': <django.forms.fields.CharField object>}
property media

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

static validate_loc_tier_fields(loc_tier_name: str, loc_tier_descr: str)[source]

Validate the various location tier record fields.

Parameters
  • loc_tier_name – name of tier

  • loc_tier_descr – description of tier

Returns

True if valid

class fpiweb.forms.LocationForm(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)[source]

Bases: django.forms.models.ModelForm

A form for use whenever you need to select row, bin, and tier

class Meta[source]

Bases: object

fields = ('loc_row', 'loc_bin', 'loc_tier')
model

alias of fpiweb.models.Location

base_fields = {'loc_bin': <django.forms.models.ModelChoiceField object>, 'loc_row': <django.forms.models.ModelChoiceField object>, 'loc_tier': <django.forms.models.ModelChoiceField object>}
declared_fields = {}
property media

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

class fpiweb.forms.LoginForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'password': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}
declared_fields = {'password': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}
property media

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

class fpiweb.forms.LogoutForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'username': <django.forms.fields.CharField object>}
declared_fields = {'username': <django.forms.fields.CharField object>}
property media

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

class fpiweb.forms.MoveToLocationForm(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)[source]

Bases: fpiweb.forms.ExistingLocationForm

base_fields = {'from_location': <django.forms.models.ModelChoiceField object>, 'loc_bin': <django.forms.models.ModelChoiceField object>, 'loc_row': <django.forms.models.ModelChoiceField object>, 'loc_tier': <django.forms.models.ModelChoiceField object>}
declared_fields = {'from_location': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.NewBoxForm(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)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ['box_number', 'box_type']
model

alias of fpiweb.models.Box

base_fields = {'box_number': <django.forms.fields.CharField object>, 'box_type': <django.forms.models.ModelChoiceField object>}
declared_fields = {'box_number': <django.forms.fields.CharField object>}
property media

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

save(commit=True)[source]

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 fpiweb.forms.NewBoxNumberField(**kwargs)[source]

Bases: fpiweb.forms.RelaxedBoxNumberField

Add a new box number to the database.

Checks whether there’s a Box with the specified box number in the database. If a matching Box is not found, store the box number in the field’s box attribute

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class fpiweb.forms.NewBoxNumberForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'box_number': <fpiweb.forms.NewBoxNumberField object>}
declared_fields = {'box_number': <fpiweb.forms.NewBoxNumberField object>}
property media

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

class fpiweb.forms.PalletNameForm(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)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('name',)
model

alias of fpiweb.models.Pallet

base_fields = {'name': <django.forms.fields.CharField object>}
declared_fields = {}
property media

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

class fpiweb.forms.PalletSelectForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'pallet': <django.forms.models.ModelChoiceField object>}
declared_fields = {'pallet': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.PrintLabelsForm(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)[source]

Bases: django.forms.forms.Form

base_fields = {'number_to_print': <django.forms.fields.IntegerField object>, 'starting_number': <django.forms.fields.IntegerField object>}
declared_fields = {'number_to_print': <django.forms.fields.IntegerField object>, 'starting_number': <django.forms.fields.IntegerField object>}
property media

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

class fpiweb.forms.ProductForm(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)[source]

Bases: django.forms.forms.Form

A form for use whenever you need to select a product.

base_fields = {'product': <django.forms.models.ModelChoiceField object>}
declared_fields = {'product': <django.forms.models.ModelChoiceField object>}
property media

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

class fpiweb.forms.RelaxedBoxNumberField(**kwargs)[source]

Bases: django.forms.fields.CharField

Define box nummber field that allows all numberics.

Accepts box number with or without BOX prefix. Returns BoxNumber with BOX prefix and leading zeros

clean(value: str) → str[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

fpiweb.forms.add_no_selection_choice(other_choices, dash_count=2)[source]
fpiweb.forms.bin_choices()[source]
fpiweb.forms.box_number_validator(value) → None[source]
fpiweb.forms.char_list_choices(constraint_name)[source]
fpiweb.forms.expire_year_choices()[source]
fpiweb.forms.min_max_choices(constraint_name)[source]
fpiweb.forms.month_choices()[source]
fpiweb.forms.none_or_int(text: str) → Optional[int][source]

Convert test to a valid integer or None.

Parameters

text

Returns

fpiweb.forms.none_or_list(text: str) → Optional[list][source]

Convert text to list or None.

Parameters

text

Returns

fpiweb.forms.none_or_str(text: str) → Optional[str][source]

Convert text to non-empty string or None.

Parameters

text

Returns

fpiweb.forms.row_choices()[source]
fpiweb.forms.tier_choices()[source]
fpiweb.forms.validate_exp_month_start_end(exp_month_start: Optional[int], exp_month_end: Optional[int]) → bool[source]

Validate the start and end month, if given.

Parameters
  • exp_month_start – number 1-12 (integer or string)

  • exp_month_end – number 1-12 (integer or string)

Returns

fpiweb.forms.validate_int_list(char_list: list) → bool[source]

Verify that all values in the list are integers.

Parameters

text

Returns

fpiweb.forms.validation_exp_months_bool(exp_month_start: Optional[int], exp_month_end: Optional[int])fpiweb.constants.ValidOrErrorResponse[source]

Validate the expiration months returning only a boolean.

Parameters
  • exp_month_start

  • exp_month_end

Returns

True if valid, False if not

fpiweb.models module

models.py - Define the database tables using ORM models.

class fpiweb.models.Activity(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Activity (history) from the past.

ADJUSTMENT_CODE_CHOICES: list = (('Fill Emptied', 'Fill emptied previous contents'), ('Move Added', 'Move added box'), ('Move Consumed', 'Move consumed the box'), ('Consume Added', 'Consume added box'), ('Consume Emptied', 'Consume emptied previous contents'))
CONSUME_ADDED: str = 'Consume Added'
CONSUME_EMPTIED: str = 'Consume Emptied'
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

FILL_EMPTIED: str = 'Fill Emptied'
MOVE_ADDED: str = 'Move Added'
MOVE_CONSUMED: str = 'Move Consumed'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

adjustment_code

Coded reason if this entry was adjusted

adjustment_code_help_text = 'Coded reason if this entry was adjusted'
box_number

Box number on box at time of consumption.

box_number_help_text = 'Box number on box at time of consumption.'
box_type

Box type holding consumed product.

box_type_help_text = 'Box type holding consumed product.'
date_consumed

Date product was consumed.

date_consumed_help_text = 'Date product was consumed.'
date_filled

Approximate date product was put in the box.

date_filled_help_text = 'Approximate date product was put in the box.'
duration

Number of days between date box was filled and consumed.

duration_help_text = 'Number of days between date box was filled and consumed.'
exp_month_end

Optional ending month product would have expired.

exp_month_end_help_text = 'Optional ending month product would have expired.'
exp_month_start

Optional starting month product would have expired.

exp_month_start_help_text = 'Optional starting month product would have expired.'
exp_year

Year product would have expired.

exp_year_help_text = 'Year product would have expired.'
get_adjustment_code_display(*, field=<django.db.models.fields.CharField: adjustment_code>)
get_next_by_date_filled(*, field=<django.db.models.fields.DateField: date_filled>, is_next=True, **kwargs)
get_previous_by_date_filled(*, field=<django.db.models.fields.DateField: date_filled>, is_next=False, **kwargs)
id

Internal record identifier for an activity.

id_help_text = 'Internal record identifier for an activity.'
loc_bin

Bin box was in at the time product was consumed.

loc_bin_help_text = 'Bin box was in at the time product was consumed.'
loc_row

Row box was in at the time product was consumed.

loc_row_help_text = 'Row box was in at the time product was consumed.'
loc_tier

Tier box was in at the time product was consumed.

loc_tier_help_text = 'Tier box was in at the time product was consumed.'
objects = <django.db.models.manager.Manager object>
prod_cat_name

Category of product consumed.

prod_cat_name_help_text = 'Category of product consumed.'
prod_name

Product contained in box at time of consumption.

prod_name_help_text = 'Product contained in box at time of consumption.'
quantity

Approximate number of items in the box when it was filled.

quantity_help_text = 'Approximate number of items in the box when it was filled.'
class fpiweb.models.Box(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Box or container for product.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

box_number

Number printed in the label on the box.

box_number_help_text = 'Number printed in the label on the box.'
box_number_max_length = 8
box_number_min_length = 8
box_type

Type of box with this number.

static box_type_default()[source]
box_type_help_text = 'Type of box with this number.'
box_type_id
date_filled

Approximate date box was filled, if filled.

date_filled_help_text = 'Approximate date box was filled, if filled.'
exp_month_end

Optional emding month range of when the product expires, if filled.

exp_month_end_help_text = 'Optional ending month range of when the product expires, if filled.'
exp_month_start

Optional starting month range of when the product expires, if filled.

exp_month_start_help_text = 'Optional starting month range of when the product expires, if filled.'
exp_year

Year the product expires, if filled.

exp_year_help_text = 'Year the product expires, if filled.'
get_absolute_url()[source]
id

Internal record identifier for box.

id_help_text = 'Internal record identifier for box.'
is_filled()[source]
location

Location of box

location_help_text = 'Location of box'
location_id
objects = <django.db.models.manager.Manager object>
palletbox_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

product

Product contained in this box, if filled.

product_help_text = 'Product contained in this box, if filled.'
product_id
quantity

Approximate or default number of items in the box, if filled.

quantity_help_text = 'Approximate or default number of items in the box, if filled.'
static select_location(queryset)[source]

Since we’re probably going to have a lot of Box queries where we also want to pull in location data

exception fpiweb.models.BoxError[source]

Bases: RuntimeError

class fpiweb.models.BoxNumber[source]

Bases: object

box_number_regex = re.compile('^BOX\\d{5}$')
box_number_search_regex = re.compile('box\\d{5}', re.IGNORECASE)
static format_box_number(int_box_number: int) → str[source]

format an integer into a box number

static get_next_box_number() → str[source]

get the next unused box number

static validate(box_number: str) → bool[source]

validate that a string is of the form ‘BOXnnnnn’

class fpiweb.models.BoxType(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Type of box (Evan’s boxes, large boxes, etc.) and default quantity.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

box_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

box_type_code

Type of box (code or shorthand).

box_type_code_help_text = 'Type of box (code or shorthand).'
box_type_descr

Type of box (description).

box_type_descr_help_text = 'Type of box (description).'
box_type_qty

Number of items (usually cans) that can typically fix in this box.

box_type_qty_help_text = 'Number of items (usually cans) that can typically fix in this box.'
id

Internal record identifier for box type.

id_help_text = 'Internal record identifier for box type.'
objects = <django.db.models.manager.Manager object>
class fpiweb.models.Constraints(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Constraints of valid values.

BIN: str = 'Bin'
CHAR_LIST = 'Char-List'
CHAR_RANGE = 'Char-MM'
CONSTRAINT_NAME_CHOICES = (('Row', 'Rows in the warehouse'), ('Bin', 'Bins in the Warehouse'), ('Tier', 'Tiers in the Warehouse'), ('Location Exclusions ', 'Warehouse locations excluded from inventory'), ('Quantity Limit', 'Typical count of items in a box'), ('Future Expiration Year Limit', 'Maximum years of future expiration permitted'))
CONSTRAINT_TYPE_CHOICES = (('Int-MM', 'Integer Min/Max'), ('Char-MM', 'Character Min/Max'), ('Int-List', 'Integer Valid List'), ('Char-List', 'Character Valid List'))
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

FUTURE_EXP_YEAR_LIMIT = 'Future Expiration Year Limit'
INT_LIST = 'Int-List'
INT_RANGE = 'Int-MM'
LOCATION_EXCLUSIONS = 'Location Exclusions '
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

QUANTITY_LIMIT: str = 'Quantity Limit'
ROW: str = 'Row'
TIER: str = 'Tier'
constraint_descr

Description of this constraint.

constraint_descr_help_text = 'Description of this constraint.'
constraint_list

If a list, what are the valid values?

constraint_list_help_text = 'If a list, what are the valid values?'
constraint_max

If a range, what is the maximum valid value?

constraint_max_help_text = 'If a range, what is the maximum valid value?'
constraint_min

If a range, what is the minimum valid value?

constraint_min_help_text = 'If a range, what is the minimum valid value?'
constraint_name

Coded name of a constraint.

constraint_name_help_text = 'Coded name of a constraint.'
constraint_type

Type of constraint (integer or character, list or range).

constraint_type_help_text = 'Type of constraint (integer or character, list or range).'
get_constraint_name_display(*, field=<django.db.models.fields.CharField: constraint_name>)
get_constraint_type_display(*, field=<django.db.models.fields.CharField: constraint_type>)
static get_values(constraint_name)[source]
id

Internal record identifier for a constraint.

id_help_text = 'Internal record identifier for a constraint.'
objects = <django.db.models.manager.Manager object>
class fpiweb.models.LocBin(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Location Bin in warehouse.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

Internal record identifier for the location bin.

id_help_text = 'Internal record id for location bin.'
loc_bin

Location Bin Designation

loc_bin_descr

Location Bin Description

loc_bin_descr_help_text = 'Location bin description'
loc_bin_descr_max_length = 20
loc_bin_help_text = 'Location bin designation'
loc_bin_max_length = 2
loc_bin_min_length = 2
location_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
class fpiweb.models.LocRow(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Location Row in warehouse.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

Internal record identifier for the location row.

id_help_text = 'Internal record id for location row.'
loc_row

Location Row Designation

loc_row_descr

Location Row Description

loc_row_descr_help_text = 'Location row description'
loc_row_descr_max_length = 20
loc_row_help_text = 'Location row designation'
loc_row_max_length = 2
loc_row_min_length = 2
location_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
class fpiweb.models.LocTier(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Location Tier in warehouse.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

Internal record identifier for the location tier.

id_help_text = 'Internal record id for location tier.'
loc_tier

Location Tier Designation

loc_tier_descr

Location Tier Description

loc_tier_descr_help_text = 'Location tier description'
loc_tier_descr_max_length = 20
loc_tier_help_text = 'Location tier designation'
loc_tier_max_length = 2
loc_tier_min_length = 2
location_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
class fpiweb.models.Location(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Location for a filled box or other container.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

box_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

static get_location(loc_row: Union[fpiweb.models.LocRow, int, str], loc_bin: Union[fpiweb.models.LocBin, int, str], loc_tier: Union[fpiweb.models.LocTier, int, str])[source]

This method originated as convenient way to retrieve a Location from the database inside a test. :param loc_row: :param loc_bin: :param loc_tier: :return: Location or None

id

Internal record identifier for location.

id_help_text = 'Internal record identifier for location.'
loc_bin

Bin indicator of this location.

loc_bin_help_text = 'Loc bin'
loc_bin_id
loc_code

Coded Location.

loc_code_help_text = 'Location code'
loc_code_max_length = 12
loc_descr

Location description.

loc_descr_help_text = 'Location description'
loc_descr_max_length = 25
loc_in_warehouse

Is this location inside the warehouse?

loc_in_warehouse_help_text = 'In warehouse?'
loc_row

Row indicator of this location.

loc_row_help_text = 'Loc row'
loc_row_id
loc_tier

Tier indicator of this location.

loc_tier_help_text = 'Loc tier'
loc_tier_id
objects = <django.db.models.manager.Manager object>
pallet_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class fpiweb.models.Pallet(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Temporary file to build up a list of boxes on a pallet.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

FILL: str = 'Fill'
MERGE: str = 'Merge'
MOVE: str = 'Move'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PALLET_STATUS_CHOICES = (('Fill', 'Fill pallet for new location'), ('Merge', 'Merging boxes on pallet'), ('Move', 'Moving boxes to new location'))
boxes

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_pallet_status_display(*, field=<django.db.models.fields.CharField: pallet_status>)
id

Internal record identifier for a pallet.

id_help_text = 'Internal record identifier for a pallet.'
location

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

location_id
name

Name of pallet.

name_help_text = 'Name of pallet'
objects = <django.db.models.manager.Manager object>
pallet_status

Current status of pallet

pallet_status_help_text = 'Current status of pallet.'
profile_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class fpiweb.models.PalletBox(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Temporary file to hold the individual boxes for a pallet. The goal of this is to ensure that either a Box record has product, expiration, and location or it has no product, no expiration, and no location.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

MOVE: str = 'Move'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

NEW: str = 'New'
ORIGINAL: str = 'Original'
PALLET_BOX_STATUS_CHOICES = (('New', 'New box added'), ('Original', 'Box already here'), ('Move', 'Box being moved'))
box

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

box_help_text = 'Internal record identifier for a box.'
box_id
box_number

Number printed in the label on the box.

box_status

Box on pallet status

box_status_help_text = 'Box on pallet status.'
exp_month_end

Optional emding month range of when the product expires, if filled.

exp_month_end_help_text = 'Optional ending month range of when the product expires, if filled.'
exp_month_start

Optional starting month range of when the product expires, if filled.

exp_month_start_help_text = 'Optional starting month range of when the product expires, if filled.'
exp_year

Year the product expires, if filled.

exp_year_help_text = 'Year the product expires, if filled.'
get_box_status_display(*, field=<django.db.models.fields.CharField: box_status>)
id

Internal record identifier for a pallet box.

id_help_text = 'Internal record identifier for a pallet box.'
objects = <django.db.models.manager.Manager object>
pallet

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

pallet_help_text = 'Internal record identifier for a pallet.'
pallet_id
product

Product contained in this box, if filled.

product_help_text = 'Product contained in this box, if filled.'
product_id
class fpiweb.models.Product(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Product name and attributes. Oranges, Pineapple, Mixed Fruit are products within the Fruits category

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

box_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

Internal record identifier for product.

id_help_text = 'Internal record identifier for product.'
objects = <django.db.models.manager.Manager object>
palletbox_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

prod_cat

Product category associated with this product.

prod_cat_help_text = 'Product category associated with this product.'
prod_cat_id
prod_name

Name of this product.

prod_name_help_text = 'Name of this product.'
productexample_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class fpiweb.models.ProductCategory(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Category or group of product. i.e. Tomato Soup, Canned Pasta, Fruits

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

Internal record identifier for product category.

id_help_text = 'Internal record identifier for product category.'
objects = <django.db.models.manager.Manager object>
prod_cat_descr

Description of this product category.

prod_cat_descr_help_text = 'Description of this product category.'
prod_cat_name

Name of this product category.

prod_cat_name_help_text = 'Name of this product category.'
product_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class fpiweb.models.ProductExample(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Examples of items that go into a labeled product.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

Internal reccord identifier for product example

id_help_text = 'Internal record identifier for product example'
objects = <django.db.models.manager.Manager object>
prod_example_name

Name of example product.

prod_example_name_help_text = 'Name of example product.'
product

Product with which this product example is associated.

product_help_text = 'Product with which this product name is associated.'
product_id
class fpiweb.models.Profile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Track more information about the users of our system.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active_pallet

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

active_pallet_help_text = 'Active Pallet'
active_pallet_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

title_help_text = 'Job title'
title_max_length = 30
user

Internal link to the default Django User table.

user_id

fpiweb.qr_code_utilities module

class fpiweb.qr_code_utilities.QRCodePrinter(url_prefix)[source]

Bases: object

fill_pdf_pages(starting_number, count)[source]
static finalize_pdf_file()[source]
static get_box_numbers(start, count) -> (<class 'str'>, <class 'int'>)[source]
get_next_box_url(starting_number, count) -> (<class 'str'>, <class 'str'>)[source]

Build the URL for the next box. :return:

get_next_qr_img(starting_number, count) -> (<class 'str'>, <class 'str'>)[source]

Build the QR image for the next box label.

Returns

a QR code image ready to print

initialize_pdf_file(buffer)[source]

Prepare to scribble on a new pdf file.

Parameters

buffer – May be a string with a filename or a BytesIO or other File-like object

print(starting_number, count, buffer)[source]
fpiweb.qr_code_utilities.get_qr_code_svg(data_string, include_xml_declaration=False)[source]

fpiweb.urls module

Manage the urls for the F. P. I. application.

fpiweb.views module

views.py - establish the views (pages) for the F. P. I. web application.

class fpiweb.views.AboutView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

The About View for this application.

context_object_name = 'about_context'
get_context_data(**kwargs)[source]

Add Site Information to About page.

Parameters

kwargs

Returns

template_name = 'fpiweb/about.html'
class fpiweb.views.ActivityDownloadView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

class Echo[source]

Bases: object

An object that implements just the write method of the file-like interface.

static write(value)[source]

Write the value by returning it, instead of storing in a buffer.

date_format = '%m/%d/%Y'
get(request, *args, **kwargs)[source]
permission_required = ('fpiweb.view_activity',)
write_rows()[source]
class fpiweb.views.BoxDetailsView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.detail.DetailView

context_object_name = 'box'
get_context_data(**kwargs)[source]

Insert the single object into the context dict.

model

alias of fpiweb.models.Box

permission_required = ('fpiweb.dummy_profile',)
template_name = 'fpiweb/box_detail.html'
class fpiweb.views.BoxEditView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

context_object_name = 'box'
form_class

alias of fpiweb.forms.NewBoxForm

model

alias of fpiweb.models.Box

permission_required = ('fpiweb.dummy_profile',)
success_url = '/fpiweb/index/'
template_name = 'fpiweb/box_edit.html'
class fpiweb.views.BoxEmptyMoveView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

get_context_data(**kwargs)[source]
permission_required = ('fpiweb.dummy_profile',)
template_name = 'fpiweb/box_empty_move.html'
class fpiweb.views.BoxEmptyView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

permission_required = ('fpiweb.dummy_profile',)
class fpiweb.views.BoxItemFormView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

static get_form(pallet_box, prefix=None)[source]
permission_required = ('fpiweb.add_box',)
post(request)[source]
template_name = 'fpiweb/box_form.html'
class fpiweb.views.BoxMoveView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

get_context_data(**kwargs)[source]
permission_required = ('fpiweb.dummy_profile',)
template_name = 'fpiweb/box_empty_move.html'
class fpiweb.views.BoxNewView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

get(request, *args, **kwargs)[source]
permission_required = ('fpiweb.dummy_profile',)
post(request, *args, **kwargs)[source]
template_name = 'fpiweb/box_new.html'
class fpiweb.views.BoxScannedView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

get(request, **kwargs)[source]
permission_required = ('fpiweb.dummy_profile',)
exception fpiweb.views.BuildPalletError[source]

Bases: RuntimeError

class fpiweb.views.BuildPalletView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

BoxFormFactory

alias of django.forms.formsets.BoxItemFormFormSet

PALLET_NAME_FORM_NAME = 'pallet_name_form'
PALLET_SELECT_FORM_NAME = 'pallet_select_form'
build_pallet_form_prefix = 'build_pallet'
confirmation_template = 'fpiweb/build_pallet_confirmation.html'
form_template = 'fpiweb/build_pallet.html'
formset_prefix = 'box_forms'
get(request)[source]
hidden_pallet_form_prefix = 'pallet'
page_title = 'Build Pallet'
permission_required = ('fpiweb.build_pallet',)
post(request)[source]
static prepare_pallet_and_pallet_boxes(pallet_form, build_pallet_form, box_forms)[source]
process_build_pallet_forms(request)[source]
show_forms_response(request, build_pallet_form, box_forms, pallet_form, status=<HTTPStatus.BAD_REQUEST: 400>)[source]

Display page with BuildPalletForm and BoxItemForms :param request: :param build_pallet_form: :param box_forms: :param pallet_form: :param status: :return:

static show_pallet_management_page(request, pallet_select_form=None, pallet_name_form=None, status_code=<HTTPStatus.OK: 200>)[source]
class fpiweb.views.ConstraintCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a constraint using a generic CreateView.

context_object_name = 'constraints'
fields = ['constraint_name', 'constraint_descr', 'constraint_type', 'constraint_min', 'constraint_max', 'constraint_list']
formClass

alias of fpiweb.forms.ConstraintsForm

model

alias of fpiweb.models.Constraints

permission_required = ('fpiweb.add_constraints',)
success_url = '/fpiweb/constraints/'
template_name = 'fpiweb/constraint_edit.html'
class fpiweb.views.ConstraintDeleteView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a constraint using a generic DeleteView.

context_object_name = 'constraints'
form_class

alias of fpiweb.forms.ConstraintsForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

model

alias of fpiweb.models.Constraints

permission_required = ('fpiweb.delete_constraints',)
success_url = '/fpiweb/constraints/'
template_name = 'fpiweb/constraint_delete.html'
class fpiweb.views.ConstraintUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

Update a constraint using a generic UpdateView.

context_object_name = 'constraints'
form_class

alias of fpiweb.forms.ConstraintsForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

get_success_url()[source]

Set the next URL to use once the edit is successful. :return:

model

alias of fpiweb.models.Constraints

permission_required = ('fpiweb.change_constraints',)
template_name = 'fpiweb/constraint_edit.html'
class fpiweb.views.ConstraintsListView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.list.ListView

List of existing constraints.

context_object_name = 'constraints_list_content'
get_context_data(*, object_list=None, **kwargs)[source]

Add additional content to the context dictionary.

Parameters
  • object_list

  • kwargs

Returns

model

alias of fpiweb.models.Constraints

permission_required = ('fpiweb.view_constraints',)
template_name = 'fpiweb/constraints_list.html'
class fpiweb.views.IndexView(**kwargs)[source]

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

Default web page (/index)

get_context_data(**kwargs)[source]

Add some security info so appropriate links can be hidden.

Parameters

kwargs

Returns

template_name = 'fpiweb/index.html'
class fpiweb.views.LocBinCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a bin using a generic CreateView.

context_object_name = 'loc_bin'
fields = ['loc_bin', 'loc_bin_descr']
formClass

alias of fpiweb.forms.LocBinForm

model

alias of fpiweb.models.LocBin

permission_required = ('fpiweb.add_locbin',)
success_url = '/fpiweb/loc_bin/'
template_name = 'fpiweb/loc_bin_edit.html'
class fpiweb.views.LocBinDeleteView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a bin using a generic DeleteView.

context_object_name = 'loc_bin'
form_class

alias of fpiweb.forms.LocBinForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

model

alias of fpiweb.models.LocBin

permission_required = ('fpiweb.delete_locbin',)
success_url = '/fpiweb/loc_bin/'
template_name = 'fpiweb/loc_bin_delete.html'
class fpiweb.views.LocBinListView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.list.ListView

List of existing bins using a generic ListView.

context_object_name = 'loc_bin_list_content'
model

alias of fpiweb.models.LocBin

permission_required = ('fpiweb.view_locbin',)
template_name = 'fpiweb/loc_bin_list.html'
class fpiweb.views.LocBinUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

Update a bin using a generic UpdateView.

context_object_name = 'loc_bin'
form_class

alias of fpiweb.forms.LocBinForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

model

alias of fpiweb.models.LocBin

permission_required = ('fpiweb.change_locbin',)
success_url = '/fpiweb/loc_bin/'
template_name = 'fpiweb/loc_bin_edit.html'
class fpiweb.views.LocRowCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a row using a generic CreateView.

context_object_name = 'loc_row'
fields = ['loc_row', 'loc_row_descr']
formClass

alias of fpiweb.forms.LocRowForm

model

alias of fpiweb.models.LocRow

permission_required = ('fpiweb.add_locrow',)
success_url = '/fpiweb/loc_row/'
template_name = 'fpiweb/loc_row_edit.html'
class fpiweb.views.LocRowDeleteView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a row using a generic DeleteView.

context_object_name = 'loc_row'
form_class

alias of fpiweb.forms.LocRowForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

model

alias of fpiweb.models.LocRow

permission_required = ('fpiweb.delete_locrow',)
success_url = '/fpiweb/loc_row/'
template_name = 'fpiweb/loc_row_delete.html'
class fpiweb.views.LocRowListView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.list.ListView

List of existing rows using a generic ListView.

context_object_name = 'loc_row_list_content'
model

alias of fpiweb.models.LocRow

permission_required = ('fpiweb.view_locrow',)
template_name = 'fpiweb/loc_row_list.html'
class fpiweb.views.LocRowUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

Update a row using a generic UpdateView.

context_object_name = 'loc_row'
form_class

alias of fpiweb.forms.LocRowForm

model

alias of fpiweb.models.LocRow

permission_required = ('fpiweb.change_locrow',)
success_url = '/fpiweb/loc_row/'
template_name = 'fpiweb/loc_row_edit.html'
class fpiweb.views.LocTierCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a tier using a generic CreateView.

context_object_name = 'loc_tier'
fields = ['loc_tier', 'loc_tier_descr']
formClass

alias of fpiweb.forms.LocTierForm

model

alias of fpiweb.models.LocTier

permission_required = ('fpiweb.add_loctier',)
success_url = '/fpiweb/loc_tier/'
template_name = 'fpiweb/loc_tier_edit.html'
class fpiweb.views.LocTierDeleteView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a tier using a generic DeleteView.

context_object_name = 'loc_tier'
form_class

alias of fpiweb.forms.LocTierForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

model

alias of fpiweb.models.LocTier

permission_required = ('fpiweb.delete_loctier',)
success_url = '/fpiweb/loc_tier/'
template_name = 'fpiweb/loc_tier_delete.html'
class fpiweb.views.LocTierListView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.list.ListView

List of existing tiers using a generic ListView.

context_object_name = 'loc_tier_list_content'
model

alias of fpiweb.models.LocTier

permission_required = ('fpiweb.view_loctier',)
template_name = 'fpiweb/loc_tier_list.html'
class fpiweb.views.LocTierUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

Update a tier using a generic UpdateView.

context_object_name = 'loc_tier'
form_class

alias of fpiweb.forms.LocTierForm

get_context_data(**kwargs)[source]

Modify the context before rendering the template.

Parameters

kwargs

Returns

model

alias of fpiweb.models.LocTier

permission_required = ('fpiweb.change_loctier',)
success_url = '/fpiweb/loc_tier/'
template_name = 'fpiweb/loc_tier_edit.html'
class fpiweb.views.LoginView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

form_class

alias of fpiweb.forms.LoginForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

success_url = '/fpiweb/index/'
template_name = 'fpiweb/login.html'
class fpiweb.views.LogoutView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

get_context_data(**kwargs)[source]
template_name = 'fpiweb/logout.html'
class fpiweb.views.MANUAL_NOTICE_TYPE(value)[source]

Bases: enum.Enum

Manual generic notice type.

NOTICE: str = 'NOTICE'
QUESTION: str = 'QUESTION'
class fpiweb.views.MaintenanceView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

Default web page (/index)

permission_required = ('fpiweb.view_system_maintenance',)
template_name = 'fpiweb/maintenance.html'
class fpiweb.views.ManualBoxMenuView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

Menu of choices for manual individual box management.

get_context_data(**kwargs)[source]

Add User Information to Manual Menu page.

Parameters

kwargs

Returns

permission_required = ('fpiweb.view_box',)
template_name = 'fpiweb/manual_ind_box_menu.html'
class fpiweb.views.ManualBoxStatusView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

MODE_CONFIRMATION = 'confirmation'
MODE_ENTER_BOX_NUMBER = 'enter_box_number'
static build_context(*, mode, box_number_form=None, box=None, box_type=None, product_form=None, product=None, location_form=None, location=None, errors=None)[source]
get(request, *args, **kwargs)[source]

Prepare to display consume box number form for the first time.

Parameters
  • request

  • args

  • kwargs

Returns

permission_required = ('fpiweb.view_box',)
post(request, *args, **kwargs)[source]
post_box_number(request)[source]
template_name = 'fpiweb/manual_box_status.html'
class fpiweb.views.ManualCheckinBoxView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

Manually check a box into inventory.

MODE_CONFIRMATION = 'confirmation'
MODE_ENTER_BOX_INFO = 'enter_box_info'
static build_context(*, mode, box_number_form=None, box_number=None, box_form=None, box=None, product_form=None, product=None, location_form=None, location=None, exp_year_form=None, exp_year=None, exp_month_start_form=None, exp_month_start=None, exp_month_end_form=None, exp_month_end=None, errors: Optional[list] = None)[source]
get(request, *args, **kwargs)[source]
permission_required = ('fpiweb.check_in_box',)
post(request, *args, **kwargs)[source]
post_box_info(request)[source]

Validate the posted information.

Parameters

request – container of initial or latest post

Returns

template_name = 'fpiweb/manual_check_in_box.html'
class fpiweb.views.ManualConsumeBoxView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

MODE_CONFIRMATION = 'confirmation'
MODE_CONSUME_BOX = 'consume_box'
MODE_ENTER_BOX_NUMBER = 'enter_box_number'
static build_context(*, mode, box_number_form=None, box=None, box_type=None, product_form=None, product=None, location_form=None, location=None, errors: Optional[list] = None)[source]
get(request, *args, **kwargs)[source]

Prepare to display consume box number form for the first time.

Parameters
  • request

  • args

  • kwargs

Returns

permission_required = ('fpiweb.check_out_box',)
post(request, *args, **kwargs)[source]
post_box_number(request)[source]
post_consume_box(request)[source]
template_name = 'fpiweb/manual_check_out_box.html'
class fpiweb.views.ManualMenuView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

Menu to choose between manual pallet or manual box management

get_context_data(**kwargs)[source]

Add User Information to Manual Menu page.

Parameters

kwargs

Returns

permission_required = ('fpiweb.view_pallet',)
template_name = 'fpiweb/manual_menu.html'
class fpiweb.views.ManualMoveBoxView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

MODE_CONFIRMATION = 'confirmation'
MODE_ENTER_BOX_NUMBER = 'enter_box_number'
MODE_ENTER_LOCATION = 'enter_location'
static build_context(*, mode, box_number_form=None, box=None, location_form=None, errors: Optional[list] = None)[source]
get(request, *args, **kwargs)[source]
permission_required = ('fpiweb.move_box',)
post(request, *args, **kwargs)[source]
post_box_number(request)[source]
post_location(request)[source]
template_name = 'fpiweb/manual_move_box.html'
class fpiweb.views.ManualNewBoxView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

MODE_CONFIRMATION = 'confirmation'
MODE_ENTER_BOX_NUMBER = 'enter_box_number'
static build_context(*, mode, box_number_form=None, box=None, box_type=None, box_type_form=None, errors: Optional[list] = None)[source]
get(request, *args, **kwargs)[source]

Prepare to display add new box number form for the first time.

Parameters
  • request

  • args

  • kwargs

Returns

permission_required = ('fpiweb.add_box',)
post(request, *args, **kwargs)[source]
post_box_number(request)[source]
template_name = 'fpiweb/manual_new_box.html'
class fpiweb.views.ManualPalletMenuView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

Menu of choices for manual pallet management.

get_context_data(**kwargs)[source]

Add User Information to Manual Menu page.

Parameters

kwargs

Returns

permission_required = ('fpiweb.view_pallet',)
template_name = 'fpiweb/manual_pallet_menu.html'
class fpiweb.views.ManualPalletMoveView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

FORM_PREFIX_CONFIRM_MERGE = 'confirm_merge'
FORM_PREFIX_FROM_LOCATION = 'from'
FORM_PREFIX_TO_LOCATION = 'to'
MODE_COMPLETE = 'complete'
MODE_CONFIRM_MERGE = 'confirm merge'
MODE_ENTER_FROM_LOCATION = 'enter from location'
MODE_ENTER_TO_LOCATION = 'enter to location'
build_response(request, mode, from_location_form=None, to_location_form=None, confirm_merge_form=None, boxes_moved=0, to_location=None, errors=None, status=<HTTPStatus.OK: 200>)[source]
get(request)[source]
static get_next_temp_name()[source]
static get_pallet_and_box_count(from_location, to_location)[source]
move_boxes(request, from_location, to_location)[source]
permission_required = ('fpiweb.move_pallet',)
post(request)[source]
post_confirm_merge_form(request)[source]
post_from_location_form(request)[source]
post_to_location_form(request)[source]
show_to_location_form(request, from_location)[source]
template = 'fpiweb/manual_pallet_move.html'
class fpiweb.views.ManualPalletNew(**kwargs)[source]

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

Establish a new pallet for this user.

context_object_name = 'manual_pallet'
get_context_data(**kwargs)[source]

Add Site Information to About page.

Parameters

kwargs

Returns

get_success_url(**kwargs) → sqlalchemy.engine.url.URL[source]
Parameters

kwargs

Returns

model

alias of fpiweb.models.Profile

template_name = 'fpiweb/manual_pallet_add.html'
class fpiweb.views.ManualPalletStatus(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.list.ListView

Establish a new pallet for this user.

context_object_name = 'manual_pallet_status'
get_(**kwargs)[source]

Add Site Information to About page.

Parameters

kwargs

Returns

model

alias of fpiweb.models.Pallet

permission_required = ('fpiweb.dummy_profile',)
success_url = '/fpiweb/manualmenu/'
template_name = 'fpiweb/manual_pallet_status.html'
class fpiweb.views.PalletManagementView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

Select current pallet, add new pallet, delete pallet

get(request)[source]
permission_required = ('fpiweb.dummy_profile',)
static show_page(request, page_title='Pallet Management', show_delete=True, prompt=None, pallet_select_form=None, pallet_name_form=None, status_code=<HTTPStatus.OK: 200>)[source]
template_name = 'fpiweb/pallet_management.html'
class fpiweb.views.PalletSelectView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.FormView

form_class

alias of fpiweb.forms.PalletSelectForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

permission_required = ('fpiweb.dummy_profile',)
success_url = '/fpiweb/index/'
template_name = 'fpiweb/pallet_select.html'
class fpiweb.views.PrintLabelsView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

get(request, *args, **kwargs)[source]
static get_base_url(meta)[source]
permission_required = ('fpiweb.print_labels_box',)
post(request, *args, **kwargs)[source]
template_name = 'fpiweb/print_labels.html'
class fpiweb.views.ScannerView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.View

static error_response(errors, status=<HTTPStatus.BAD_REQUEST: 400>)[source]
static get_box(scan_data=None, box_number=None)[source]
static get_box_data(scan_data=None, box_number=None)[source]
static get_keyed_in_box_number(box_number)[source]
Parameters

box_number – the box number (a string), may be None

Returns

permission_required = ('fpiweb.dummy_profile',)
post(request, *args, **kwargs)[source]
static response(success, data=None, errors=None, status=<HTTPStatus.OK: 200>)[source]
exception fpiweb.views.ScannerViewError[source]

Bases: RuntimeError

class fpiweb.views.TestScanView(**kwargs)[source]

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.base.TemplateView

static get_box_scanned_url(box_number)[source]
static get_box_url_by_filters(**filters)[source]
get_context_data(**kwargs)[source]
permission_required = ('fpiweb.dummy_profile',)
template_name = 'fpiweb/test_scan.html'
fpiweb.views.error_page(request, message=None, message_list=(), status=<HTTPStatus.BAD_REQUEST: 400>)[source]
fpiweb.views.get_user_and_profile(request)[source]
fpiweb.views.manual_generic_notification(request, note_type: fpiweb.views.MANUAL_NOTICE_TYPE, title: str = None, message_list: tuple = (), action_message: str = '', yes_url: str = 'fpiweb:about', no_url: str = 'fpiweb:about', return_url: str = 'fpiweb:about', status: int = <HTTPStatus.OK: 200>)[source]

Provide a generic notification screen for the manual box subsystem.

Parameters
  • request – request info from calling view

  • note_type – type of notice (error or note)

  • title – title to use for notification

  • message_list – List of lines to display in notification

  • action_message – final message or question

  • yes_url – if question, url for yes action

  • no_url – if question, url for no action

  • return_url – if notice, url to go to after notification

  • status – status code to flag notification if needed

Returns