P-9
This commit is contained in:
1 parent
b10128405a
commit
2cb5d8d689
8 files changed
+105
-12
No files matched your search
@@ -1,6 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from .models import *
|
||||
from django.db.models import Q
|
||||
from about_inspection.models import InspectionDirections
|
||||
# Register your models here.
|
||||
class DictEmployeeAdmin(admin.ModelAdmin):
|
||||
# A handy constant for the name of the alternate database.
|
||||
@@ -9,9 +10,25 @@ class DictEmployeeAdmin(admin.ModelAdmin):
|
||||
search_fields = ('login', 'fio',)
|
||||
list_editable=('birthdate',)
|
||||
|
||||
class DepartmentDirections(admin.TabularInline):
|
||||
model =InspectionDirections
|
||||
fields = ( 'direction_title',)
|
||||
verbose_name="Направление деятельности отдела"
|
||||
verbose_name_plural= "Направления деятельности отдела"
|
||||
can_delete = True
|
||||
# show_change_link = False
|
||||
extra = 0
|
||||
|
||||
|
||||
# class DictEmployeeAdmin(admin.ModelAdmin):
|
||||
class DictDepartmentAdmin(admin.ModelAdmin):
|
||||
readonly_fields=( 'name', 'name_from_ad')
|
||||
inlines = [DepartmentDirections]
|
||||
def get_queryset(self, request):
|
||||
qs = super().get_queryset(request)
|
||||
qs = qs.filter(deleted=0)
|
||||
return qs
|
||||
|
||||
|
||||
|
||||
admin.site.register(DictEmployee,DictEmployeeAdmin)
|
||||
admin.site.register(DictDepartment, DictDepartmentAdmin )
|
||||
@@ -109,6 +109,7 @@ class DictCompetencesType(models.Model):
|
||||
|
||||
|
||||
class DictDepartment(models.Model):
|
||||
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
|
||||
id_curator = models.ForeignKey('DictEmployee', models.DO_NOTHING, db_column='id_curator', blank=True, null=True, db_comment='╚─ ъєЁрЄюЁр юЄфхыр', related_name='deps_curator')
|
||||
id_chief = models.ForeignKey('DictEmployee', models.DO_NOTHING, db_column='id_chief', related_name='dictdepartment_id_chief_set', blank=True, null=True, db_comment='╚─ эрўры№эшър юЄфхыр')
|
||||
name = models.CharField(max_length=500, db_comment='═рчтрэшх юЄфхыр')
|
||||
@@ -119,10 +120,13 @@ class DictDepartment(models.Model):
|
||||
order_department = models.IntegerField()
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Отдел"
|
||||
verbose_name_plural = "Отделы"
|
||||
managed = False
|
||||
db_table = 'dict_department'
|
||||
db_table_comment = '╤яЁртюўэшъ юЄфхыют'
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
class DictEmployee(models.Model):
|
||||
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
|
||||
|
||||
Reference in new issue
Block a user