728x90
반응형

model 생성

from django.db import models

class Board(models.Model):
    objects = models.Manager()
    start_date = models.DateField(verbose_name='시작날짜')
    end_date = models.DateField(verbose_name='종료날짜')
    company = models.CharField(max_length=128,
                                verbose_name='업체명')
    position = models.CharField(max_length=128,
                                verbose_name='직책')
    guest_name = models.CharField(max_length=32,
                                verbose_name='출입자명')

    def __str__(self):
        return self.guest_name

    class Meta:
        db_table = 'board'
        verbose_name = '출입명단'
        verbose_name_plural = '출입명단'

 


 

class has no objects member 에러 해결하기

objects = models.Manager()는 나중에 views.py에서 엑셀 export를 구현하기 위해 objects를 사용하려고 했더니  

class has no objects member 에러가 떠서 추가한 코드임

반응형
복사했습니다!