开发者

Manager isn't accessible via PermiLayer instances error in django

Why do I get such an error only for PermiLayer model , when the same code/logic works perfectly fine for other models .

My code is this

 uperm = PermiLayer()
 perml=uperm.objects.get(pk = num)

Ps: I have already tried Manager isn't accessible via `Model` instances solutions there . But didn;'t work out

Edit:

This is my models

from django.contrib.gis.db import models
from django.contrib.auth.models import Us开发者_如何学Goer
from django.contrib.contenttypes.models import ContentType
from maps.models import  Sdr_Layer
from OsmMap.models import OsmLayers
class PermiLayer(models.Model):
    user = models.ForeignKey(User)
    table = models.IntegerField()
    permi = models.IntegerField()


Managers are accessible only via Model Classes, rather than from model instances https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-objects

why don't you just get it like

perml=PermiLayer.objects.get(pk = num)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜