-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
# ============================================================================= | ||
# Docstring | ||
# ============================================================================= | ||
|
||
""" | ||
Provides IFC ... Model Class | ||
=================================== | ||
For more information, refer to: | ||
""" # noqa E501 | ||
|
||
|
||
# ============================================================================= | ||
# Import | ||
# ============================================================================= | ||
|
||
# Import | Standard Library | ||
|
||
# Import | Libraries | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
# Import | Local Modules | ||
from ...fields.model import ( | ||
IfcLabelField, | ||
IfcRoleTypeField, | ||
IfcTextField, | ||
) | ||
|
||
|
||
# ============================================================================= | ||
# Classes | ||
# ============================================================================= | ||
|
||
from django.db import models | ||
from django.contrib.contenttypes.fields import GenericRelation | ||
from django.contrib.contenttypes.models import ContentType | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
class IfcUnitRelation(models.Model): | ||
""" | ||
Model to facilitate a GenericRelation from IfcUnitAssignment to various IfcUnit models | ||
""" | ||
object_id = models.PositiveIntegerField() | ||
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) | ||
unit = GenericRelation('IfcUnit', related_query_name='unit_relations') | ||
|
||
content_object = GenericForeignKey('content_type', 'object_id') | ||
|
||
# Class | Model Meta Class | ||
# ========================================================================= | ||
|
||
class Meta: | ||
""" | ||
Meta Class | ||
---------- | ||
""" | ||
|
||
# Class | Model Methods | ||
# ========================================================================= | ||
|
||
def __str__(self) -> str: | ||
""" | ||
""" | ||
return f"{self.content_object}" | ||
|
||
|
||
# ============================================================================= | ||
# Module Variables | ||
# ============================================================================= | ||
|
||
__all__ = [ | ||
"IfcActorRoleModel", | ||
] |