Data Models
Bases: Model
Location Model
Represents a physical or logical location with attributes for identification, metadata, and status.
Attributes:
Name | Type | Description |
---|---|---|
id |
UUIDField
|
The primary key for the location, automatically generated as a UUID. |
slug |
SlugField
|
A unique, optional slug for the location, used for URL-friendly identifiers. |
created_by |
ForeignKey
|
The user who created the location, linked to the User model. |
created_at |
DateTimeField
|
The timestamp when the location was created, automatically set. |
updated_by |
ForeignKey
|
The user who last updated the location, linked to the User model. Optional. |
updated_at |
DateTimeField
|
The timestamp when the location was last updated, automatically set. |
name |
CharField
|
The unique name of the location. |
description |
TextField
|
An optional description of the location. |
is_active |
BooleanField
|
Indicates whether the location is active. Defaults to True. |
is_deleted |
BooleanField
|
Indicates whether the location is marked as deleted. Defaults to False. |
Methods:
Name | Description |
---|---|
__str__ |
Returns the string representation of the location, which is its name. |
Source code in core/models.py
Bases: Model
Box Model
Represents a storage box with hierarchical relationships, location, and metadata.
Attributes:
Name | Type | Description |
---|---|---|
id |
UUIDField
|
Unique identifier for the box, automatically generated. |
slug |
SlugField
|
Optional unique slug for the box, used for URL-friendly identifiers. |
created_by |
ForeignKey
|
Reference to the user who created the box. |
created_at |
DateTimeField
|
Timestamp of when the box was created. |
updated_by |
ForeignKey
|
Reference to the user who last updated the box (optional). |
updated_at |
DateTimeField
|
Timestamp of the last update to the box. |
parent |
ForeignKey
|
Optional reference to a parent box, enabling hierarchical relationships. |
name |
CharField
|
Name of the box, required and unique within a location. |
description |
TextField
|
Optional description of the box. |
location |
ForeignKey
|
Reference to the location where the box is stored. |
is_active |
BooleanField
|
Indicates whether the box is active (default is True). |
is_deleted |
BooleanField
|
Indicates whether the box is marked as deleted (default is False). |
Methods:
Name | Description |
---|---|
__str__ |
Returns the name of the box as its string representation. |
Source code in core/models.py
Bases: Model
Item Model
Represents an item that can be stored in a box. Each item has a unique identifier, a name, and optional descriptive fields. Items are associated with a box and can be created or updated by a user.
Attributes:
Name | Type | Description |
---|---|---|
id |
UUIDField
|
The unique identifier for the item. |
slug |
SlugField
|
A unique slug for the item, optional. |
created_by |
ForeignKey
|
The user who created the item. |
created_at |
DateTimeField
|
The timestamp when the item was created. |
updated_by |
ForeignKey
|
The user who last updated the item, optional. |
updated_at |
DateTimeField
|
The timestamp when the item was last updated. |
name |
CharField
|
The name of the item. |
description |
TextField
|
A description of the item, optional. |
quantity |
IntegerField
|
The quantity of the item, defaults to 1. |
box |
ForeignKey
|
The box the item belongs to, optional. |
is_active |
BooleanField
|
Indicates if the item is active, defaults to True. |
is_deleted |
BooleanField
|
Indicates if the item is deleted, defaults to False. |
Methods:
Name | Description |
---|---|
__str__ |
Returns the string representation of the item, which is its name. |
Source code in core/models.py
Bases: Model
Represents a file entity in the system, which can be associated with an item, box, or location.
Attributes:
Name | Type | Description |
---|---|---|
id |
UUIDField
|
The unique identifier for the file. |
slug |
SlugField
|
A unique slug for the file, optional. |
created_by |
ForeignKey
|
The user who created the file. |
created_at |
DateTimeField
|
The timestamp when the file was created. |
updated_by |
ForeignKey
|
The user who last updated the file, optional. |
updated_at |
DateTimeField
|
The timestamp when the file was last updated. |
name |
CharField
|
The name of the file. |
description |
TextField
|
A description of the file, optional. |
file |
FileField
|
The file itself, stored in the "files/" directory. |
item |
ForeignKey
|
The item associated with the file. |
box |
ForeignKey
|
The box associated with the file, optional. |
location |
ForeignKey
|
The location associated with the file, optional. |
is_active |
BooleanField
|
Indicates whether the file is active. |
is_deleted |
BooleanField
|
Indicates whether the file is deleted. |
Methods:
Name | Description |
---|---|
__str__ |
Returns the name of the file as its string representation. |
Source code in core/models.py
Bases: Model
Represents a URL that stores information about URLs associated with items, boxes, or locations.
Attributes:
Name | Type | Description |
---|---|---|
id |
UUIDField
|
The primary key for the URL, generated automatically as a UUID. |
slug |
SlugField
|
An optional slug field for the URL, unique and limited to 250 characters. |
created_by |
ForeignKey
|
A reference to the user who created the URL. |
created_at |
DateTimeField
|
The timestamp when the URL was created, set automatically. |
updated_by |
ForeignKey
|
A reference to the user who last updated the URL, optional. |
updated_at |
DateTimeField
|
The timestamp when the URL was last updated, set automatically. |
description |
TextField
|
An optional text field for additional information about the URL. |
name |
CharField
|
The name of the URL, limited to 255 characters. |
url |
URLField
|
The actual URL being stored. |
item |
ForeignKey
|
An optional reference to an associated item. |
box |
ForeignKey
|
An optional reference to an associated box. |
location |
ForeignKey
|
An optional reference to an associated location. |
is_active |
BooleanField
|
Indicates whether the URL is active. Defaults to True. |
is_deleted |
BooleanField
|
Indicates whether the URL is marked as deleted. Defaults to False. |
Methods:
Name | Description |
---|---|
__str__ |
Returns the string representation of the URL. |