删除操作重新规划
This commit is contained in:
parent
9ad48ccd7b
commit
5407d639f9
|
@ -1,10 +1,10 @@
|
|||
# from django.urls import path, include
|
||||
# from .views import CertaccessViewSet
|
||||
# from rest_framework import routers
|
||||
from django.urls import path, include
|
||||
from .views import CertaccessViewSet
|
||||
from rest_framework import routers
|
||||
|
||||
# router = routers.DefaultRouter()
|
||||
# router.register('certaccess', CertaccessViewSet, basename="certaccess")
|
||||
router = routers.DefaultRouter()
|
||||
|
||||
# urlpatterns = [
|
||||
# path('', include(router.urls))
|
||||
# ]
|
||||
|
||||
urlpatterns = [
|
||||
path('', include(router.urls))
|
||||
]
|
|
@ -57,7 +57,7 @@ class Enterprise(CommonBModel):
|
|||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
return self.code
|
||||
class EnterpriseAddress(CommonAModel):
|
||||
type_choices = (
|
||||
('注册地址', '注册地址'),
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-29 01:56
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('plan', '0007_auto_20200911_0954'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='contactrecord',
|
||||
name='belong_dept',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='contactrecord',
|
||||
name='create_by',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='contactrecord',
|
||||
name='update_by',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-29 01:57
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('plan', '0008_auto_20201029_0956'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contactrecord',
|
||||
name='create_by',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contactrecord_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='contactrecord',
|
||||
name='update_by',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contactrecord_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
|
||||
),
|
||||
]
|
|
@ -4,11 +4,11 @@ from django.db import models
|
|||
from rest_framework.exceptions import ParseError
|
||||
from simple_history.models import HistoricalRecords
|
||||
|
||||
from apps.system.models import CommonAModel, CommonBModel, Dict, User
|
||||
from apps.system.models import CommonAModel, CommonBModel, Dict, User, BaseBModel, BaseModel
|
||||
from apps.project.models import Project, CertApp
|
||||
# Create your models here.
|
||||
|
||||
class Plan(CommonBModel):
|
||||
class Plan(BaseBModel):
|
||||
"""
|
||||
计划(项目组)
|
||||
"""
|
||||
|
@ -22,7 +22,7 @@ class Plan(CommonBModel):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class ContactRecord(CommonBModel):
|
||||
class ContactRecord(CommonAModel):
|
||||
"""
|
||||
联系记录
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-29 01:56
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0054_certappunit_assessor'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='certappunit',
|
||||
name='teststate',
|
||||
field=models.CharField(blank=True, choices=[('待提交CTC', '待提交CTC'), ('待CTC下达', '待CTC下达'), ('待实验室检验', '待实验室检验'), ('到样检测中', '到样检测中'), ('待提取报告', '待提取报告'), ('待实验室整改', '待实验室整改'), ('待评定', '待评定'), ('已评定', '已评定'), ('任务撤销', '任务撤销')], default='待提交CTC', max_length=50, null=True, verbose_name='任务状态'),
|
||||
),
|
||||
]
|
|
@ -6,7 +6,7 @@ from rest_framework.exceptions import ParseError
|
|||
from simple_history.models import HistoricalRecords
|
||||
from apps.certset.models import ImplementRule, UnitType, Evaluations, Standard
|
||||
from apps.crm.models import Enterprise
|
||||
from apps.system.models import CommonAModel, CommonBModel, Dict, User
|
||||
from apps.system.models import CommonAModel, CommonBModel, Dict, User, BaseBModel
|
||||
# from apps.plan.models import Plan
|
||||
|
||||
# Create your models here.
|
||||
|
@ -81,7 +81,7 @@ from apps.system.models import CommonAModel, CommonBModel, Dict, User
|
|||
|
||||
# def __str__(self):
|
||||
# return self.number
|
||||
class Project(CommonBModel):
|
||||
class Project(BaseBModel):
|
||||
"""
|
||||
认证项目
|
||||
"""
|
||||
|
@ -118,7 +118,9 @@ class Project(CommonBModel):
|
|||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
if self.number:
|
||||
return self.number
|
||||
return ''
|
||||
|
||||
|
||||
class CertApp(CommonBModel):
|
||||
|
@ -192,6 +194,9 @@ class CertApp(CommonBModel):
|
|||
verbose_name = '认证受理'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
return self.number
|
||||
|
||||
class CertAppFlow(model.BaseModel):
|
||||
"""
|
||||
certapp流转记录
|
||||
|
@ -214,8 +219,7 @@ class EvaluationDetail(CommonBModel):
|
|||
class Meta:
|
||||
verbose_name = '评审记录详情'
|
||||
verbose_name_plural = verbose_name
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Certappunit(CommonBModel):
|
||||
"""
|
||||
|
@ -277,9 +281,6 @@ class Certappunit(CommonBModel):
|
|||
verbose_name = '认证单元'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
# def save(self, *args, **kwargs):
|
||||
# super().save(*args, **kwargs)
|
||||
|
|
|
@ -192,6 +192,19 @@ class CommonBModel(SoftModel):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class BaseBModel(BaseModel):
|
||||
"""
|
||||
业务用基本表BB,包含create_by, update_by, belong_dept字段, 物理删除
|
||||
"""
|
||||
create_by = models.ForeignKey(
|
||||
User, null=True, blank=True, on_delete=models.SET_NULL, verbose_name='创建人', related_name = '%(class)s_create_by')
|
||||
update_by = models.ForeignKey(
|
||||
User, null=True, blank=True, on_delete=models.SET_NULL, verbose_name='最后编辑人', related_name = '%(class)s_update_by')
|
||||
belong_dept = models.ForeignKey(
|
||||
Organization, null=True, blank=True, on_delete=models.SET_NULL, verbose_name='所属部门', related_name= '%(class)s_belong_dept')
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class File(CommonAModel):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue