开发者

Getting unmanaged models

I seem to have a problem after creating an unmanaged model (syncdb):

class Client_jobs(models.Model):
    job_id = models.IntegerField(primary_key=True)
    status = models.IntegerField()

    class Meta:
        db_table = 'client_jobs'
        managed=False

in one of my def views, it calls the database view(Client_jobs)

def listjobs(request):
    # if user is authenticated
       if request.user.is_authenticated():
          jobsArr = Client_jobs.objects.get.all()

The page returned me an error of

(1146,开发者_JAVA百科 "Table 'table1.client_jobs' doesn't exist")

I know I'm missing something but I can't figure out. How does django detect this unmanaged model? Thank you.


as I know the db_table option will get precedence over the existing convention of app name_model name. If you set it explicitly you will have to prefix the application name yourself. try client_jobs.client_jobs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜