开发者

Unvalid tag library with Inclusion tag using Django

I'm creating an inclusion tag to include a survey in my news page. But here is the error I get : 'survey_extras' is not a valid tag library: ImportError raised l开发者_JAVA技巧oading survey.templatetags.survey_extras: No module named models

I only know i have a problem with the following import in my survey_extras : from survey.models import Question the message is : Unresolved import : Question. Whereas Question is a class in my survey's model.

Here is my survey_extras :

from django import template
from survey.models import Question


register = template.Library();

@register.inlusion_tag('form.html',takes_context=True)
def survey_inclusion(context):
    """ """
   text = Question.objects.filter()
   return {'text':text}

Do you have any ideas ? thank you

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜