How to add attribute '_meta' to an object?

前端 未结 1 477
我寻月下人不归
我寻月下人不归 2021-01-23 03:52

I\'m trying to add the django-voting app to my project. I don\'t know how to use it in my templates, so I\'m adding a new template tags for voting up or down when an user click

相关标签:
1条回答
  • 2021-01-23 04:25

    The problem is that obj here is not actually an object, but a queryset with one element. You should use get instead of filter, as get actually returns a model instance.

    obj = Place.objects.get(id=object_id)
    
    0 讨论(0)
提交回复
热议问题