Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

Error db_table is used by multiple models: Django

Im confused what does this error mean?, when I tried to transfer my project to another pc and runs using python manage.py runserver this error will display. It would be great if anybody could figure out where I am doing something wrong. thank you so much in advance.

enter image description here

My whole models.py and the error indicates class Fundsource, position and CivilStatus is used by multiple models

from django.db import models
from datetime import datetime
from django.core.validators import MinValueValidator, MaxValueValidator
from django_resized import ResizedImageField



class DjangoContentType(models.Model):
    app_label = models.CharField(max_length=100, unique=True)
    model = models.CharField(max_length=100, unique=True)

    class Meta:
        managed = False
        db_table = 'django_content_type'



class AuthPermission(models.Model):
    name = models.CharField(max_length=255)
    content_type = models.ForeignKey(DjangoContentType, models.DO_NOTHING)
    codename = models.CharField(max_length=100, unique=True)

    class Meta:
        managed = False
        db_table = 'auth_permission'

class AuthUser(models.Model):
    password = models.CharField(max_length=128 , null=True)
    last_login = models.DateTimeField(blank=True, null=True)
    is_superuser = models.IntegerField()
    username = models.CharField(max_length=150 , null=True)
    first_name = models.CharField(max_length=30)
    middle_name = models.CharField(max_length=64)
    last_name = models.CharField(max_length=150)
    email = models.CharField(max_length=254)
    is_staff = models.IntegerField()
    is_active = models.IntegerField()
    date_joined = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'auth_user'

class AuthUserUserPermissions(models.Model):
    user = models.ForeignKey(AuthUser, models.DO_NOTHING)
    permission = models.ForeignKey(AuthPermission, models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'auth_user_user_permissions'


class AuthUserApplicants(models.Model):
    password = models.CharField(max_length=255, blank=True, null=True)
    last_login = models.DateTimeField(blank=True, null=True)
    username = models.CharField(max_length=255,unique=True,)
    firstname = models.CharField(max_length=255)
    middle_name = models.CharField(max_length=255)
    last_name = models.CharField(max_length=255)
    email = models.CharField(max_length=255)
    date_joined = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'auth_user_applicants'



class UserApplicantsPersonalinfo(models.Model):
    user = models.ForeignKey(AuthUserApplicants, models.DO_NOTHING)
    address = models.CharField(max_length=255, blank=True, null=True)
    gender = models.IntegerField(blank=True, null=True)
    mobile_no = models.CharField(max_length=255, blank=True, null=True)
    course = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'user_applicants_personalinfo'
        

class Appstatus(models.Model):
    name = models.CharField(max_length=64, unique=True)
    acronym = models.CharField(max_length=64, unique=True)
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return self.name
        
    class Meta:
        db_table = 'hrppms_appstatus'



class HrppmsHiredreq(models.Model):
    name = models.CharField(max_length=255)
    empstatus =  models.ForeignKey(Appstatus, models.DO_NOTHING)
    is_required = models.BooleanField()
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'hrppms_hiredreq'



class Fundsource(models.Model):
    name = models.CharField(max_length=64, unique=True)
    acronym = models.CharField(max_length=64)
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return self.name

    class Meta:
        db_table = 'hrppms_fundsource'


class Position(models.Model):
    name = models.CharField(max_length=64, unique=True)
    acronym = models.CharField(max_length=64, unique=True)
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return '{} - {}'.format(self.name, self.acronym)

    class Meta:
        db_table = 'hrppms_position'


class Program(models.Model):
    name = models.CharField(max_length=64, unique=True)
    acronym = models.CharField(max_length=64, unique=True)
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return self.name

    class Meta:
        db_table = 'hrppms_program'


class Requirements(models.Model):
    name = models.CharField(max_length=128, unique=True)
    acronym = models.CharField(max_length=64, blank=True, null=True)
    is_required = models.BooleanField()
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return self.name

    class Meta:
        managed = False
        db_table = 'hrppms_requirements'


class HrppmsAoa(models.Model):
    name = models.CharField(max_length=164, unique=True)
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return self.name

    class Meta:
        managed = False
        db_table = 'hrppms_aoa'


class HrppmsNature(models.Model):
    name = models.CharField(max_length=128, unique=True)
    status = models.BooleanField()
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    def __str__(self):
        return self.name

    class Meta:
        managed = False
        db_table = 'hrppms_nature'

class Extension(models.Model):
    ext_name = models.CharField(max_length=128, unique=True)

    class Meta:
        verbose_name_plural = "Name Extension"
        db_table = 'pds_nameextension'


class CivilStatus(models.Model):
    cs_name = models.CharField(max_length=128, unique=True)
    cs_status = models.IntegerField()

    class Meta:
        verbose_name_plural = "Civil Status"
        db_table = 'pds_civilstatus'

class BloodType(models.Model):
    bt_name = models.CharField(max_length=128, unique=True)

    class Meta:
        verbose_name_plural = "Blood Type"
        db_table = 'pds_bloodtype'
        
class Personalinfo(models.Model):
    user = models.ForeignKey(AuthUser, models.DO_NOTHING)
    ext = models.ForeignKey(Extension, models.DO_NOTHING)
    dob = models.DateField()
    pob = models.CharField(max_length=64)
    gender = models.IntegerField()
    cs = models.ForeignKey(CivilStatus, models.DO_NOTHING)
    height = models.DecimalField(max_digits=11, decimal_places=2)
    weight = models.DecimalField(max_digits=11, decimal_places=2)
    bt = models.ForeignKey(BloodType, models.DO_NOTHING)
    cit_id = models.IntegerField()
    isfilipino = models.IntegerField()
    is_dualcitizenship = models.IntegerField()
    dc_bybirth = models.IntegerField()
    dc_bynaturalization = models.IntegerField()
    mobile_no = models.CharField(max_length=11)
    telephone_no = models.CharField(max_length=10)
    course = models.CharField(max_length=128)
    picture = models.FileField(upload_to='picture/', default='picture/default.jpg')

    class Meta:
        managed = False
        db_table = 'pds_personalinfo'


class Vacancies(models.Model):
    pos = models.ForeignKey(Position, models.DO_NOTHING)
    salary_rate = models.DecimalField(max_digits=15, decimal_places=2)
    salary_grade = models.CharField(max_length=100)
    appstatus = models.ForeignKey(Appstatus, models.DO_NOTHING)
    program = models.ForeignKey(Program, models.DO_NOTHING, null=True, blank=True)
    fundsource = models.ForeignKey(Fundsource, models.DO_NOTHING)
    item_number = models.CharField(max_length=128)
    qty = models.IntegerField()
    top_id = models.IntegerField()
    level_id = models.IntegerField()
    former_incumbent = models.CharField(max_length=128, null=True)
    aoa = models.ForeignKey(HrppmsAoa, models.DO_NOTHING)
    location = models.CharField(max_length=64)
    reports_to = models.CharField(max_length=64)
    others = models.TextField()
    education = models.CharField(max_length=128)
    training = models.CharField(max_length=128)
    experience = models.CharField(max_length=128)
    eligibility = models.CharField(max_length=128)
    attachment = models.FileField(upload_to='vacancy_attachment/', null=True, blank=True)
    upload_by = models.ForeignKey(AuthUser, models.DO_NOTHING)
    created_at = models.DateTimeField(default=datetime.now)
    deadline_at = models.DateField()
    deployment_date = models.DateField(null=True, blank=True)
    secretariat = models.ForeignKey(Personalinfo, models.DO_NOTHING)
    status = models.BooleanField(default=True)

    class Meta:
        managed = False
        db_table = 'hrppms_vacancies'



class Workflow(models.Model):
    workflow_name = models.CharField(max_length=128)
    step = models.IntegerField()
    status = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'oas_workflow'


class HrppmsSourceofapplication(models.Model):
    source_name = models.CharField(max_length=255, blank=True, null=True)
    uploaded_by = models.ForeignKey(AuthUser, models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'hrppms_sourceofapplication'


class HrppmsBatch(models.Model):
    name = models.CharField(max_length=255, blank=True, null=True, unique=True)

    class Meta:
        managed = False
        db_table = 'hrppms_batch'


class Applicants(models.Model):
    vacancies = models.ForeignKey(Vacancies, models.DO_NOTHING)
    app_code = models.CharField(max_length=64)
    status = models.IntegerField()
    pi = models.ForeignKey(Personalinfo, models.DO_NOTHING , related_name='filescreen_by', blank=True, null=True)
    created_at = models.DateTimeField(default=datetime.now)
    workflow_status = models.ForeignKey(Workflow, models.DO_NOTHING)
    performance_rating = models.IntegerField()
    education = models.DecimalField(max_digits=15, decimal_places=2, blank=True, null=True)
    experience = models.DecimalField(max_digits=15, decimal_places=2, blank=True, null=True)
    training = models.DecimalField(max_digits=15, decimal_places=2, blank=True, null=True)
    eligibility = models.CharField(max_length=128)
    remarks = models.TextField()
    filescreen_by = models.ForeignKey(Personalinfo, models.DO_NOTHING, blank=True, null=True)
    sourceof_app = models.ForeignKey(HrppmsSourceofapplication, models.DO_NOTHING,  blank=True, null=True)
    batch = models.ForeignKey(HrppmsBatch, models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'oas_applicants'



class ApplicantsFile(models.Model):
    app = models.ForeignKey(Applicants, models.DO_NOTHING)
    filename = models.TextField()
    req_id = models.IntegerField()

    def extension(self):
        return self.filename.split('.')[-1]

    class Meta:
        managed = False
        db_table = 'oas_applicants_file'


class HrppmsAppscore(models.Model):
    app = models.ForeignKey(Applicants, models.DO_NOTHING)
    qe_score = models.FloatField(blank=True, null=True)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...