42
app/project_management/migrations/0001_initial.py
Normal file
42
app/project_management/migrations/0001_initial.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-17 18:45
|
||||
|
||||
import access.fields
|
||||
import access.models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('access', '0005_organization_manager_organization_model_notes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Project',
|
||||
fields=[
|
||||
('is_global', models.BooleanField(default=False)),
|
||||
('id', models.AutoField(primary_key=True, serialize=False, unique=True)),
|
||||
('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
|
||||
('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
|
||||
('name', models.CharField(max_length=50, unique=True)),
|
||||
('slug', access.fields.AutoSlugField()),
|
||||
('description', models.TextField(blank=True, default=None, null=True)),
|
||||
('code', models.CharField(help_text='Project Code', max_length=25, unique=True)),
|
||||
('planned_start_date', models.DateTimeField(blank=True, help_text='When the project is planned to have been started by.', null=True, verbose_name='Planned Start Date')),
|
||||
('planned_finish_date', models.DateTimeField(blank=True, help_text='When the project is planned to be finished by.', null=True, verbose_name='Planned Finish Date')),
|
||||
('real_start_date', models.DateTimeField(blank=True, help_text='When work commenced on the project.', null=True, verbose_name='Real Start Date')),
|
||||
('real_finish_date', models.DateTimeField(blank=True, help_text='When work was completed for the project', null=True, verbose_name='Real Finish Date')),
|
||||
('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.TenancyObject.validatate_organization_exists])),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Project',
|
||||
'verbose_name_plural': 'Projects',
|
||||
'ordering': ['code', 'name'],
|
||||
},
|
||||
),
|
||||
]
|
35
app/project_management/models/project_common.py
Normal file
35
app/project_management/models/project_common.py
Normal file
@ -0,0 +1,35 @@
|
||||
from django.db import models
|
||||
|
||||
from access.fields import *
|
||||
from access.models import TenancyObject
|
||||
|
||||
|
||||
class ProjectCommonFields(TenancyObject, models.Model):
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
id = models.AutoField(
|
||||
primary_key=True,
|
||||
unique=True,
|
||||
blank=False
|
||||
)
|
||||
|
||||
created = AutoCreatedField()
|
||||
|
||||
modified = AutoLastModifiedField()
|
||||
|
||||
|
||||
|
||||
class ProjectCommonFieldsName(ProjectCommonFields):
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
name = models.CharField(
|
||||
blank = False,
|
||||
max_length = 50,
|
||||
unique = True,
|
||||
)
|
||||
|
||||
slug = AutoSlugField()
|
@ -1,9 +1,9 @@
|
||||
from django.db import models
|
||||
|
||||
from access.models import TenancyObject
|
||||
from .project_common import ProjectCommonFieldsName
|
||||
|
||||
|
||||
class ProjectModel(TenancyObject):
|
||||
class Project(ProjectCommonFieldsName):
|
||||
|
||||
|
||||
class Meta:
|
||||
@ -18,30 +18,69 @@ class ProjectModel(TenancyObject):
|
||||
verbose_name_plural = 'Projects'
|
||||
|
||||
|
||||
|
||||
class ProjectStates(enum):
|
||||
OPEN = 1
|
||||
CLOSED = 1
|
||||
# class ProjectStates(enum):
|
||||
# OPEN = 1
|
||||
# CLOSED = 1
|
||||
|
||||
|
||||
name
|
||||
description = models.TextField(
|
||||
blank = True,
|
||||
default = None,
|
||||
null= True,
|
||||
)
|
||||
|
||||
description
|
||||
# priority
|
||||
|
||||
priority
|
||||
|
||||
state
|
||||
|
||||
percent_done # Auto-Calculate
|
||||
|
||||
project_type
|
||||
|
||||
code
|
||||
|
||||
planned_start_date
|
||||
|
||||
planned_finish_date
|
||||
|
||||
real_start_date
|
||||
# state
|
||||
|
||||
|
||||
# project_type
|
||||
|
||||
code = models.CharField(
|
||||
blank = False,
|
||||
help_text = 'Project Code',
|
||||
max_length = 25,
|
||||
unique = True,
|
||||
)
|
||||
|
||||
planned_start_date = models.DateTimeField(
|
||||
blank = True,
|
||||
help_text = 'When the project is planned to have been started by.',
|
||||
null = True,
|
||||
verbose_name = 'Planned Start Date',
|
||||
)
|
||||
|
||||
planned_finish_date = models.DateTimeField(
|
||||
blank = True,
|
||||
help_text = 'When the project is planned to be finished by.',
|
||||
null = True,
|
||||
verbose_name = 'Planned Finish Date',
|
||||
)
|
||||
|
||||
real_start_date = models.DateTimeField(
|
||||
blank = True,
|
||||
help_text = 'When work commenced on the project.',
|
||||
null = True,
|
||||
verbose_name = 'Real Start Date',
|
||||
)
|
||||
|
||||
real_finish_date = models.DateTimeField(
|
||||
blank = True,
|
||||
help_text = 'When work was completed for the project',
|
||||
null = True,
|
||||
verbose_name = 'Real Finish Date',
|
||||
)
|
||||
|
||||
model_notes = None
|
||||
|
||||
|
||||
@property
|
||||
def percent_completed(self) -> str: # Auto-Calculate
|
||||
""" How much of the project is completed.
|
||||
|
||||
Returns:
|
||||
str: Calculated percentage of project completion.
|
||||
"""
|
||||
|
||||
return 'xx %'
|
||||
|
||||
|
Reference in New Issue
Block a user