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
精彩评论