Professional Documents
Culture Documents
Final
Final
The first of these will attempt to pack as much of the cargo using any
of the packing methods available to CARGO MANAGEMENT SYSTEM. This may be a
loading from the floor or from the end of the container. The second and third options are self
explanatory and the one most appropriate to the practical circumstances should be selected.
1
SYSTEM ANALYSIS
Existing System
The real challenge is not just to capture the complete life cycle of a
shipment from original booking through to invoicing, but to do so in a dynamic and timely
way. With new developments in data handling and communications, it is now possible to
build a data warehouse that receives seamless, real time updates from reservation systems and
with minimal changes to existing systems.
Proposed System
Most cargo customers, unlike passengers, are more concerned with speed
and reliability than with routings. That gives the cargo carrier an opportunity to route
shipments away from congested bottlenecks and give a better spread of revenues across the
network.
For example, a booking request comes through the reservation center to ship
between a hub airport and major destination. The route is consistently oversold, so the bid
rate is high. The router will evaluate alternative feasible routes which meet both the shipper’s
requirements and the carrier’s business rules.
2
Removing the Politics
3
System Configuration
3.1 HARDWARE REQUIREMENTS
• System : Dual Core Processor.
• Hard Disk : 320 GB.
• RAM : 2 GB
• Monitor : 15 VGA Colour.
• Mouse : Logitech.
• Keyboard : Logitech.
4
System Design
UML Diagrams:
Actor:
A coherent set of roles that users of use cases play when interacting with the use
`cases.
Use case:
UML stands for Unified Modeling Language. UML is a language for specifying,
visualizing and documenting the system. This is the step while developing any product after
analysis. The goal from this is to produce a model of the entities involved in the project
which later need to be built. The representation of the entities that are to be used in the
product being developed need to be designed.
5
Activity Diagram
State chat Diagram
USECASE DIAGRAMS:
Use case diagrams model behavior within a system and helps the
developers understand of what the user require. The stick man represents what’s called an
actor.
Use case diagram can be useful for getting an overall view of the
system and clarifying that can do and more importantly what they can’t do.
Use case diagram consists of use cases and actors and shows the
interaction between the use case and actors.
The purpose is to show the interactions between the use case and actor.
To represent the system requirements from user’s perspective.
An actor could be the end-user of the system or an external system.
6
USECASE DIAGRAM:
A Use case is a description of set of sequence of actions.
Graphically it is rendered as an ellipse with solid line including only its name. Use case
diagram is a behavioral diagram that shows a set of use cases and actors and their
relationship. It is an association between the use cases and actors. An actor represents a real-
world object
Regestration
Login
Search for
address
Actor
Book a Cargo
View status of
Cargo
7
SEQUENCE DIAGRAM:
Sequence diagram and collaboration diagram are called INTERACTION
DIAGRAMS. An interaction diagram shows an interaction, consisting of set of objects and
their relationship including the messages that may be dispatched among them.
Registration
Authentication View Cargo Price
Book a Cargo
Status of Cargo
Valid user
8
COLLABORATION DIAGRAM:
A collaboration diagram is an introduction diagram that emphasizes the structural
organization of the objects that send and receive messages. Graphically a collaboration
diagram is a collection of vertices and arcs.
9
1 .Valid User
Registration Login
5.Not Valid User
2.Authentication
3.Valid User
Cargo price
Book a Cargo
Class is nothing but a structure that contains both variables and methods. The Class
Diagram shows a set of classes, interfaces, and collaborations and their relating ships. There
is most common diagram in modeling the object oriented systems and are used to give the
static view of a system. It shows the dependency between the classes that can be used in our
system.
The interactions between the modules or classes of our projects are shown below.
Each block contains Class Name, Variables and Methods.
CLASS:
A description of set of objects that share the same attributes, operations, relationships,
and semantics
10
maintaining
user details status
status
user registration
customername-varchar(20)
username-varchar(20) phno-int(10)
password-varchar(20) emailid-varchar(30)
phno-int(10) address-varchar(50)
emailid_varchar(30) type of meterial-varchar(10)
product name-varchar(10)
noofproducts -int(10)
source-varchar(20)
destination-varchar(20)
destinationaddress-varchar(20)
date -varchar(10)
update user details time -(varchar(10)
delete userdetails customerid-int(10)
searchuser
view user
11
State Chart Diagram
User registration
Booking Cargo
12
DATA FLOW DIAGRAMS:
The DFD takes an input-process-output view of a system i.e. data objects flow
into the software, are transformed by processing elements, and resultant data objects flow out
of the software.
The DFD enables the software engineer to develop models of the information
domain & functional domain at the same time. As the DFD is refined into greater levels of
details, the analyst perform an implicit functional decomposition of the system. At the same
time, the DFD refinement results in a corresponding refinement of the data as it moves
through the process that embody the applications.
A context-level DFD for the system the primary external entities produce
information for use by the system and consume information generated by the system. The
labeled arrow represents data objects or object hierarchy.
13
RULES FOR DFD:
Identify and label each process internal to the system with Rounded circles.
A process is required for all the data transformation and Transfers. Therefore,
never connect a data store to a data Source or the destinations or another data store
with just a Data flow arrow.
Make sure the names of the processes accurately convey everything the process is
done.
Identify all data flows for each process step, except simple Record retrievals.
14
USER REGISTRATION
User
User registration details
Booking cargo
15
E-R Diagrams:
it maps well to the relational model. The constructs used in the ER model can easily
be transformed into relational tables.
it is simple and easy to understand with a minimum of training. Therefore, the model
can be used by the database designer to communicate the design to the end user.
In addition, the model can be used as a design plan by the database developer to
implement a data model in a specific database management software.
16
E-R Notation
There is no standard for representing data objects in E-R diagrams. Each modeling
methodology uses its own notation. The original notation used by Chen is widely used in
academics texts and journals but rarely seen in either CASE tools or publications by non-
academics. Today, there are a number of notations used, among the more common are
Bachman, crow's foot, and IDEFIX.
All notational styles represent entities as rectangular boxes and relationships as lines
connecting boxes. Each style uses a special set of symbols to represent the cardinality of a
connection. The notation used in this document is from Martin. The symbols used for the
basic ER constructs are:
Entities are represented by labeled rectangles. The label is the name of the entity.
Relationships are represented by a solid line connecting two entities. The name of the
Attributes, when included, are listed inside the entity rectangle. Attributes which are
Mandatory existence is shown by the bar (looks like a 1) next to the entity for an
instance is required. Optional existence is shown by placing a circle next to the entity
that is optional.
17
Project Description
Software Description:
PYTHON
DJANGO
18
Applications of Python
Python lets you develop a web application without too much trouble. It has libraries
for internet protocols like HTML and XML, JSON, e-mail processing, FTP, IMAP, and easy-
to-use socket interface. Yet, the package index has more libraries:
19
Django also provides an optional administrative create, read, update and delete interface that
is generated dynamically through introspection and configured via admin models
20
PROJECT MODULES
MODULES:
ADMINISTRATOR MODULE
LOGIN MODULE
USER MODULE
MODULE DESCRIPTION
ADMINISTRATOR MODULE :
LOGIN MODULE :
USER MODULE :
This module will provide inbox for the user to view the messages from the
administrator. It also provides to view the status of your cargo. This module also provides
to cancel the cargo.
21
OVERVIEW OF TECHNOLOGIES USED
DATABASE TABLES:
22
NAME NOT / NOTNULL TYPE
23
SOFTWARE IMPLEMENTATION
REGISTER PAGE
LOGIN PAGE
24
SEARCH PAGE
PRICE FINDER
STATUS REPORT
25
CUSTOMER DETAILS
CANCEL REQUEST
26
"""
"""
import warnings
__all__ = (
27
'inlineformset_factory', 'modelform_factory',
ALL_FIELDS = '__all__'
"""
"""
opts = instance._meta
cleaned_data = form.cleaned_data
file_field_list = []
for f in opts.fields:
continue
continue
continue
# Leave defaults for fields that aren't in POST data, except for
# checkbox inputs because they don't appear in POST data if not checked.
if (
f.has_default() and
28
form[f.name].field.widget.value_omitted_from_data(form.data, form.files,
form.add_prefix(f.name)) and
cleaned_data.get(f.name) in form[f.name].field.empty_values
):
continue
if isinstance(f, models.FileField):
file_field_list.append(f)
else:
f.save_form_data(instance, cleaned_data[f.name])
for f in file_field_list:
f.save_form_data(instance, cleaned_data[f.name])
return instance
# ModelForms
#################################################################
"""
named.
29
``exclude`` is an optional list of field names. If provided, exclude the
named from the returned dict, even if they are listed in the ``fields``
argument.
"""
opts = instance._meta
data = {}
continue
continue
continue
data[f.name] = f.value_from_object(instance)
return data
def apply_limit_choices_to_to_formfield(formfield):
limit_choices_to = formfield.get_limit_choices_to()
formfield.queryset = formfield.queryset.complex_filter(limit_choices_to)
30
formfield_callback=None, localized_fields=None,
field_classes=None, *, apply_limit_choices_to=True):
"""
named fields.
named fields from the returned fields, even if they are listed in the
``fields`` argument.
a form field.
31
``field_classes`` is a dictionary of model field names mapped to a form
field class.
"""
field_dict = {}
ignored = []
opts = model._meta
raise FieldError(
f.name, model.__name__)
continue
continue
continue
kwargs = {}
32
if widgets and f.name in widgets:
kwargs['widget'] = widgets[f.name]
kwargs['localize'] = True
kwargs['label'] = labels[f.name]
kwargs['help_text'] = help_texts[f.name]
kwargs['error_messages'] = error_messages[f.name]
kwargs['form_class'] = field_classes[f.name]
if formfield_callback is None:
formfield = f.formfield(**kwargs)
else:
if formfield:
if apply_limit_choices_to:
apply_limit_choices_to_to_formfield(formfield)
field_dict[f.name] = formfield
else:
ignored.append(f.name)
if fields:
33
field_dict = {
return field_dict
class ModelFormOptions:
class ModelFormMetaclass(DeclarativeFieldsMetaclass):
base_formfield_callback = None
for b in bases:
base_formfield_callback = b.Meta.formfield_callback
break
34
formfield_callback = attrs.pop('formfield_callback', base_formfield_callback)
if bases == (BaseModelForm,):
return new_class
# of ('foo',)
'model': new_class.__name__,
'opt': opt,
'value': value,
})
raise TypeError(msg)
if opts.model:
35
raise ImproperlyConfigured(
if opts.fields == ALL_FIELDS:
opts.fields = None
fields = fields_for_model(
apply_limit_choices_to=False,
missing_fields = none_model_fields.difference(new_class.declared_fields)
if missing_fields:
opts.model.__name__)
raise FieldError(message)
36
# Override default model fields with any custom declared ones
fields.update(new_class.declared_fields)
else:
fields = new_class.declared_fields
new_class.base_fields = fields
return new_class
class BaseModelForm(BaseForm):
renderer=None):
opts = self._meta
if opts.model is None:
if instance is None:
self.instance = opts.model()
object_data = {}
else:
self.instance = instance
37
if initial is not None:
object_data.update(initial)
self._validate_unique = False
super().__init__(
renderer=renderer,
apply_limit_choices_to_to_formfield(formfield)
def _get_validation_exclusions(self):
"""
"""
exclude = []
for f in self.instance._meta.fields:
field = f.name
38
exclude.append(f.name)
exclude.append(f.name)
exclude.append(f.name)
exclude.append(f.name)
# Exclude empty fields that are not required by the form, if the
# from raising a required error. Note: don't exclude the field from
# from validation.
else:
form_field = self.fields[field]
field_value = self.cleaned_data.get(field)
exclude.append(f.name)
39
return exclude
def clean(self):
self._validate_unique = True
return self.cleaned_data
opts = self._meta
if hasattr(errors, 'error_dict'):
error_dict = errors.error_dict
else:
NON_FIELD_ERRORS in opts.error_messages):
error_messages = opts.error_messages[NON_FIELD_ERRORS]
error_messages = self.fields[field].error_messages
else:
continue
40
for message in messages:
message.code in error_messages):
message.message = error_messages[message.code]
self.add_error(None, errors)
def _post_clean(self):
opts = self._meta
exclude = self._get_validation_exclusions()
# are excluded from basic field value validation. This is for two
if isinstance(field, InlineForeignKeyField):
exclude.append(name)
try:
except ValidationError as e:
self._update_errors(e)
41
try:
self.instance.full_clean(exclude=exclude, validate_unique=False)
except ValidationError as e:
self._update_errors(e)
if self._validate_unique:
self.validate_unique()
def validate_unique(self):
"""
"""
exclude = self._get_validation_exclusions()
try:
self.instance.validate_unique(exclude=exclude)
except ValidationError as e:
self._update_errors(e)
def _save_m2m(self):
"""
Save the many-to-many fields and generic relations for this form.
"""
cleaned_data = self.cleaned_data
exclude = self._meta.exclude
42
fields = self._meta.fields
opts = self.instance._meta
# m2m field).
continue
continue
continue
if f.name in cleaned_data:
f.save_form_data(self.instance, cleaned_data[f.name])
"""
a save_m2m() method to the form which can be called after the instance
"""
if self.errors:
raise ValueError(
self.instance._meta.object_name,
43
)
if commit:
self.instance.save()
self._save_m2m()
else:
self.save_m2m = self._save_m2m
return self.instance
save.alters_data = True
pass
field_classes=None):
"""
Return a ModelForm containing form fields for the given model. You can
44
``fields`` is an optional list of field names. If provided, include only
the named fields in the returned fields. If omitted or '__all__', use all
fields.
named fields from the returned fields, even if they are listed in the
``fields`` argument.
a form field.
field class.
"""
45
# inner class.
attrs['fields'] = fields
attrs['exclude'] = exclude
attrs['widgets'] = widgets
attrs['localized_fields'] = localized_fields
attrs['labels'] = labels
attrs['help_texts'] = help_texts
attrs['error_messages'] = error_messages
attrs['field_classes'] = field_classes
# If parent form class already has an inner Meta, the Meta we're
if formfield_callback:
Meta.formfield_callback = staticmethod(formfield_callback)
46
# Give this new form class a reasonable name.
form_class_attrs = {
'Meta': Meta,
'formfield_callback': formfield_callback
raise ImproperlyConfigured(
# ModelFormSets
##############################################################
class BaseModelFormSet(BaseFormSet):
"""
"""
47
model = None
unique_fields = set()
self.queryset = queryset
self.initial_extra = initial
def initial_form_count(self):
if not self.is_bound:
return len(self.get_queryset())
return super().initial_form_count()
return self._object_dict.get(pk)
"""
48
"""
field = field.remote_field.get_related_field()
return field.to_python
if pk_required:
if self.is_bound:
try:
pk = self.data[pk_key]
except KeyError:
pass
else:
to_python = self._get_to_python(self.model._meta.pk)
try:
pk = to_python(pk)
except ValidationError:
pass
else:
kwargs['instance'] = self._existing_object(pk)
else:
49
kwargs['instance'] = self.get_queryset()[i]
elif self.initial_extra:
try:
except IndexError:
pass
if pk_required:
form.fields[self.model._meta.pk.name].required = True
return form
def get_queryset(self):
qs = self.queryset
else:
qs = self.model._default_manager.get_queryset()
if not qs.ordered:
qs = qs.order_by(self.model._meta.pk.name)
50
# related objects/inlines from being displayed.
self._queryset = qs
return self._queryset
"""Save and return a new model instance for the given form."""
return form.save(commit=commit)
"""Save and return an existing model instance for the given form."""
return form.save(commit=commit)
if commit:
obj.delete()
"""
Save model instances for every form, adding and changing instances
"""
if not commit:
self.saved_forms = []
def save_m2m():
51
form.save_m2m()
self.save_m2m = save_m2m
save.alters_data = True
def clean(self):
self.validate_unique()
def validate_unique(self):
all_unique_checks = set()
all_date_checks = set()
forms_to_delete = self.deleted_forms
exclude = form._get_validation_exclusions()
all_unique_checks.update(unique_checks)
all_date_checks.update(date_checks)
errors = []
seen_data = set()
52
# Get the data for the set of fields that must be unique among the forms.
row_data = (
row_data = tuple(
if row_data in seen_data:
errors.append(self.get_unique_error_message(unique_check))
form._errors[NON_FIELD_ERRORS] =
self.error_class([self.get_form_error()])
# remove the data from the cleaned_data dict since it was invalid
if field in form.cleaned_data:
del form.cleaned_data[field]
seen_data.add(row_data)
53
for date_check in all_date_checks:
seen_data = set()
# if it's a date lookup we need to get the data for all the fields
if lookup == 'date':
date = form.cleaned_data[unique_for]
# object
else:
if data in seen_data:
errors.append(self.get_date_error_message(date_check))
form._errors[NON_FIELD_ERRORS] =
self.error_class([self.get_form_error()])
# remove the data from the cleaned_data dict since it was invalid
del form.cleaned_data[field]
seen_data.add(data)
54
if errors:
raise ValidationError(errors)
if len(unique_check) == 1:
"field": unique_check[0],
else:
return gettext("Please correct the duplicate data for %(field)s, which must be
unique.") % {
return gettext(
)%{
'field_name': date_check[2],
'date_field': date_check[3],
'lookup': str(date_check[1]),
def get_form_error(self):
55
def save_existing_objects(self, commit=True):
self.changed_objects = []
self.deleted_objects = []
if not self.initial_forms:
return []
saved_instances = []
forms_to_delete = self.deleted_forms
obj = form.instance
if obj.pk is None:
continue
if form in forms_to_delete:
self.deleted_objects.append(obj)
self.delete_existing(obj, commit=commit)
elif form.has_changed():
self.changed_objects.append((obj, form.changed_data))
if not commit:
self.saved_forms.append(form)
return saved_instances
56
def save_new_objects(self, commit=True):
self.new_objects = []
if not form.has_changed():
continue
# If someone has marked an add form for deletion, don't save the
# object.
continue
self.new_objects.append(self.save_new(form, commit=commit))
if not commit:
self.saved_forms.append(form)
return self.new_objects
self._pk_field = pk = self.model._meta.pk
# add it here so we can tell which object is which when we get the
def pk_is_not_editable(pk):
return (
57
pk.remote_field and pk.remote_field.parent_link and
pk_is_not_editable(pk.remote_field.model._meta.pk)
if form.is_bound:
# in the database.
else:
try:
pk_value = self.get_queryset()[index].pk
else:
pk_value = None
except IndexError:
pk_value = None
qs = pk.remote_field.model._default_manager.get_queryset()
else:
qs = self.model._default_manager.get_queryset()
qs = qs.using(form.instance._state.db)
if form._meta.widgets:
else:
widget = HiddenInput
58
form.fields[self._pk_field.name] = ModelChoiceField(qs, initial=pk_value,
required=False, widget=widget)
super().add_fields(form, index)
raise ImproperlyConfigured(
formfield_callback=formfield_callback,
widgets=widgets, localized_fields=localized_fields,
labels=labels, help_texts=help_texts,
error_messages=error_messages, field_classes=field_classes)
can_order=can_order, can_delete=can_delete,
59
validate_min=validate_min, validate_max=validate_max)
FormSet.model = model
return FormSet
# InlineFormSets
#############################################################
class BaseInlineFormSet(BaseModelFormSet):
if instance is None:
self.instance = self.fk.remote_field.model()
else:
self.instance = instance
self.save_as_new = save_as_new
if queryset is None:
queryset = self.model._default_manager
qs = queryset.filter(**{self.fk.name: self.instance})
else:
qs = queryset.none()
self.unique_fields = {self.fk.name}
60
# sure validation isn't skipped on that field.
if isinstance(self.form._meta.fields, tuple):
self.form._meta.fields = list(self.form._meta.fields)
self.form._meta.fields.append(self.fk.name)
def initial_form_count(self):
if self.save_as_new:
return 0
return super().initial_form_count()
if self.save_as_new:
form.data._mutable = True
# Remove the primary key from the form's data, we are only
form.data[form.add_prefix(self._pk_field.name)] = None
form.data[form.add_prefix(self.fk.name)] = None
form.data._mutable = mutable
# Set the fk value here so that the form can do its validation.
61
fk_value = self.instance.pk
if self.fk.remote_field.field_name != self.fk.remote_field.model._meta.pk.name:
return form
@classmethod
def get_default_prefix(cls):
# form (it may have been saved after the formset was originally
# instantiated).
super().add_fields(form, index)
if self._pk_field == self.fk:
name = self._pk_field.name
else:
# The foreign key field might not be on the form, so we poke at the
# Model field to get the label, since we need that for error messages.
name = self.fk.name
62
kwargs = {
# based on the parent model's pk. If this isn't the case, set to_field
if self.fk.remote_field.field_name != self.fk.remote_field.model._meta.pk.name:
kwargs['to_field'] = self.fk.remote_field.field_name
if self.instance._state.adding:
to_field = self.instance._meta.get_field(kwargs['to_field'])
else:
to_field = self.instance._meta.pk
if to_field.has_default():
return super().get_unique_error_message(unique_check)
63
def _get_foreign_key(parent_model, model, fk_name=None, can_fail=False):
"""
Find and return the ForeignKey from model to parent if there is one
parent_model.
"""
opts = model._meta
if fk_name:
if len(fks_to_parent) == 1:
fk = fks_to_parent[0]
raise ValueError(
raise ValueError(
else:
64
# Try to discover what the ForeignKey from model to parent_model is
fks_to_parent = [
f for f in opts.fields
f.remote_field.model == parent_model or
f.remote_field.model in parent_model._meta.get_parent_list()
if len(fks_to_parent) == 1:
fk = fks_to_parent[0]
if can_fail:
return
raise ValueError(
model._meta.label,
parent_model._meta.label,
else:
raise ValueError(
"'%s' has more than one ForeignKey to '%s'. You must specify "
model._meta.label,
parent_model._meta.label,
65
return fk
formset=BaseInlineFormSet, fk_name=None,
"""
to ``parent_model``.
"""
# enforce a max_num=1 when the foreign key to the parent model is unique.
if fk.unique:
max_num = 1
kwargs = {
'form': form,
'formfield_callback': formfield_callback,
'formset': formset,
'extra': extra,
'can_delete': can_delete,
'can_order': can_order,
66
'fields': fields,
'exclude': exclude,
'min_num': min_num,
'max_num': max_num,
'widgets': widgets,
'validate_min': validate_min,
'validate_max': validate_max,
'localized_fields': localized_fields,
'labels': labels,
'help_texts': help_texts,
'error_messages': error_messages,
'field_classes': field_classes,
FormSet.fk = fk
return FormSet
# Fields
#####################################################################
class InlineForeignKeyField(Field):
"""
A basic integer field that deals with validating the given value to a
"""
widget = HiddenInput
67
default_error_messages = {
'invalid_choice': _('The inline value did not match the parent instance.'),
self.parent_instance = parent_instance
self.pk_field = pk_field
self.to_field = to_field
if self.to_field:
else:
kwargs["initial"] = self.parent_instance.pk
kwargs["required"] = False
super().__init__(*args, **kwargs)
if value in self.empty_values:
if self.pk_field:
return None
return self.parent_instance
if self.to_field:
else:
orig = self.parent_instance.pk
68
if str(value) != str(orig):
return self.parent_instance
return False
class ModelChoiceIteratorValue:
self.value = value
self.instance = instance
def __str__(self):
return str(self.value)
if isinstance(other, ModelChoiceIteratorValue):
other = other.value
class ModelChoiceIterator:
self.field = field
self.queryset = field.queryset
69
def __iter__(self):
queryset = self.queryset
if not queryset._prefetch_related_lookups:
queryset = queryset.iterator()
yield self.choice(obj)
def __len__(self):
# count() adds a query but uses less memory since the QuerySet results
# won't be cached. In most cases, the choices will only be iterated on,
def __bool__(self):
return (
ModelChoiceIteratorValue(self.field.prepare_value(obj), obj),
self.field.label_from_instance(obj),
class ModelChoiceField(ChoiceField):
70
"""A ChoiceField whose choices are a model QuerySet."""
default_error_messages = {
iterator = ModelChoiceIterator
blank=False, **kwargs):
# ChoiceField.__init__().
Field.__init__(
if (
):
self.empty_label = None
else:
self.empty_label = empty_label
self.queryset = queryset
71
self.limit_choices_to = limit_choices_to # limit the queryset later.
self.to_field_name = to_field_name
def get_limit_choices_to(self):
"""
"""
if callable(self.limit_choices_to):
return self.limit_choices_to()
return self.limit_choices_to
result.queryset = self.queryset.all()
return result
def _get_queryset(self):
return self._queryset
self.widget.choices = self.choices
72
queryset = property(_get_queryset, _set_queryset)
"""
Convert objects into strings and generate the labels for the choices
"""
return str(obj)
def _get_choices(self):
if hasattr(self, '_choices'):
return self._choices
# accessed) so that we can ensure the QuerySet has not been consumed. This
# the queryset.
return self.iterator(self)
73
choices = property(_get_choices, ChoiceField._set_choices)
if hasattr(value, '_meta'):
if self.to_field_name:
return value.serializable_value(self.to_field_name)
else:
return value.pk
return super().prepare_value(value)
if value in self.empty_values:
return None
try:
if isinstance(value, self.queryset.model):
return value
if self.disabled:
74
return False
class ModelMultipleChoiceField(ModelChoiceField):
widget = SelectMultiple
hidden_widget = MultipleHiddenInput
default_error_messages = {
warnings.warn(
"'invalid_list'.",
RemovedInDjango40Warning, stacklevel=2,
self.error_messages['invalid_list'] = self.error_messages['list']
75
def to_python(self, value):
if not value:
return []
return list(self._check_values(value))
value = self.prepare_value(value)
return self.queryset.none()
raise ValidationError(
self.error_messages['invalid_list'],
code='invalid_list',
qs = self._check_values(value)
self.run_validators(value)
return qs
"""
76
"""
try:
value = frozenset(value)
except TypeError:
raise ValidationError(
self.error_messages['invalid_list'],
code='invalid_list',
for pk in value:
try:
self.queryset.filter(**{key: pk})
raise ValidationError(
self.error_messages['invalid_pk_value'],
code='invalid_pk_value',
params={'pk': pk},
raise ValidationError(
self.error_messages['invalid_choice'],
77
code='invalid_choice',
params={'value': val},
return qs
prepare_value = super().prepare_value
return super().prepare_value(value)
if self.disabled:
return False
if initial is None:
initial = []
if data is None:
data = []
if len(initial) != len(data):
return True
78
def modelform_defines_fields(form_class):
REGISTER PAGE
<html>
<head>
</head>
<body>
<body bgcolor=pink>
<center>
<td align="center"colspan="7">
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
79
<tr align="center">
<td>User name</td>
</td>
</tr>
<tr align="center">
<td>password</td>
<td><input type="text"name="password"/><br>
</td>
</tr>
<tr align="center">
<td>Phone no</td>
</td>
</tr>
<tr align="center">
<td>email id</td>
</td>
</tr>
<tr>
<input type="submit"value="submit"/>
</td>
</tr>
</table>
</body>
80
</html>
LOGIN PAGE
<html>
<head>
</head>
<body>
<body bgcolor=pink>
<center>
<td align="center"colspan="7">
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
</table>
<tr align="center">
<td>username</td>
81
</td>
</tr>
<tr align="center">
<td>password</td>
<td><input type="text"name="password"/><br>
</td>
</tr>
<tr>
</td>
</tr>
<tr>
<input type="button"value="login"/>
</td>
</tr>
</table>
</body>
</html>
SEARCH PAGE
<html>
<head>
</head>
82
<body>
<body bgcolor=pink>
<center>
<td align="center"colspan="7">
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
<tr align="center">
<td>States</td>
<td><select name="select"name="states">
<option value="Tamilnadu">Tamilnadu</option>
<option value="Delhi">Delhi</option>
<option value="Hyderabad">Hyderabad</option>
</select>
</td>
83
</tr>
<tr align="center">
<td>Location</td>
<option value="Hyderabad">Hyderabad</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Delhi">Delhi</option>
</select>
</td>
</tr>
</table><br>
<center>
</center>
</body>
</html>
PRICE FINDER
<html>
<head>
</head>
<body>
<body bgcolor=pink>
<center>
<td align="center"colspan="7">
84
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
</table>
<tr align="center">
<td>Orgin city</td>
<option value="-1">Select</option>
<option value="trp">Trichy</option>
<option value="cbe">Coimbatore</option>
<option value="cne">Chennai</option>
<option value="tjn">Thanjavur</option>
</select>
</td>
</tr>
<tr align="center">
<td>Destination city</td>
85
<td><select name="text"value="select"/>
<option value="-1">Select</option>
<option value="trp">Trichy</option>
<option value="cbe">Coimbatore</option>
<option value="cne">Chennai</option>
<option value="tjn">Thanjavur</option>
</select>
</td>
</tr>
<tr align="center">
<td>weight</td>
<td><select name="text"value="select"/><br><br>
<option value="-1">Select</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="150">150</option>
</select>
</td>
</tr>
<tr align="center">
<td>total</td>
<td><input type="text"value=""/>
</td>
</tr>
<tr>
<input type="submit"value="find"/><br>
86
</td>
</tr>
</table>
</body>
</html>
STATUS REPORT
<html>
<head>
</head>
<body>
<body bgcolor=pink>
<center>
<td align="center"colspan="7">
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
87
</table>
<tr align="center">
<td>Customer id</td>
</td>
</tr>
<tr align="center">
<td>Customer name</td>
</td>
</tr>
</table>
<br>
<tr align="center">
<td>
<input type="button"value="status"/><br><br><br>
</body>
</html>
CUSTOMER DETAILS
<html>
<head>
</head>
<body>
<body bgcolor=pink>
88
<table align="center" border="1"width=40%">
<center>
<td align="center"colspan="7">
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
</table>
<tr align="center">
<td>Customer Name</td>
</td>
</tr>
<tr align="center">
<td>Phone no</td>
</td>
</tr>
89
<tr align="center">
<td>email id</td>
</td>
</tr>
<tr align="center">
<td>Address</td>
<td><input type="text"name="Address"/><br>
</td>
</tr>
<tr align="center">
<td>Type Of Material</td>
</td>
</tr>
<tr align="center">
<td>Product Name</td>
</td>
</tr>
<tr align="center">
<td>Number Of Products</td>
</td>
</tr>
<tr align="center">
<td>Source</td>
90
<td><input type="text"name="Source"/><br>
</td>
</tr>
<tr align="center">
<td>Destination</td>
<td><input type="text"name="Destination"/><br>
</td>
</tr>
<tr align="center">
<td>Destination Address</td>
</td>
</tr></table>
</body>
</html>
CANCEL REQUEST
<html>
<head>
</head>
<body>
<body bgcolor=pink>
<center>
<td align="center"colspan="7">
91
<img src="cargo.jpg">
<tr align="center"style="color:green">
<tr align="center">
</tr>
</table>
<tr align="center">
<td>Customer Id</td>
</td>
</tr>
<tr align="center">
</td>
</tr>
<tr align="center">
<td>Date</td>
92
</td>
</tr>
<tr>
</td>
</tr>
</table>
</body>
</html>
93
Testing
SYSTEM TEST
TYPES OF TESTS
Unit testing
Unit testing involves the design of test cases that validate that the internal
program logic is functioning properly, and that program inputs produce valid outputs. All
decision branches and internal code flow should be validated. It is the testing of individual
software units of the application .it is done after the completion of an individual unit before
integration. This is a structural testing, that relies on knowledge of its construction and is
invasive. Unit tests perform basic tests at component level and test a specific business
process, application, and/or system configuration. Unit tests ensure that each unique path of a
business process performs accurately to the documented specifications and contains clearly
defined inputs and expected results.
Integration testing
Integration tests are designed to test integrated software components to
determine if they actually run as one program. Testing is event driven and is more concerned
with the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically aimed
at exposing the problems that arise from the combination of components.
94
Functional test
Functional tests provide systematic demonstrations that functions tested are
available as specified by the business and technical requirements, system documentation, and
user manuals.
Functional testing is centered on the following items:
System Test
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An example of
system testing is the configuration oriented system integration test. System testing is based on
process descriptions and flows, emphasizing pre-driven process links and integration points.
95
Black Box Testing
Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most other
kinds of tests, must be written from a definitive source document, such as specification or
requirements document, such as specification or requirements document. It is a testing in
which the software under test is treated, as a black box .you cannot “see” into it. The test
provides inputs and responds to outputs without considering how the software works.
Unit Testing
Unit testing is usually conducted as part of a combined code and unit test
phase of the software lifecycle, although it is not uncommon for coding and unit testing to be
conducted as two distinct phases.
Field testing will be performed manually and functional tests will be written
in detail.
Test objectives
All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.
Features to be tested
Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page.
Integration Testing
Software integration testing is the incremental integration testing of two or
more integrated software components on a single platform to produce failures caused by
interface defects.
96
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
97
CONCLUSION
The package was designed in such a way that future modifications can be
done easily. The following conclusions can be deduced from the development of
the project.
98
FUTURE ENHANCEMENT
The system can be designed for further enhancement. This could also be developed
99