如何删除 html 的查询集“< [ <]>(代码标记?)”(Django)

How to remove the querysets '< [ <]>(code markers?)' for html (Django)

我正在尝试获取编造演出的列表,(并希望将它们链接起来,以便在不同的 html 中查看它们)。

现在的页面结果是这样的;

,<演出:寻找活动人员!>]>

我不知道如何删除查询集 'code markers(or what are they called?)'。只想列出演出名称。我该如何解决这个问题,只显示演出标题?

这是我的代码:

Html:

                <div class="col">
                    {% if profile %}
                    <div class="row justify-content-between">
                        <div class="col-9">
                            <p><b>My Gigs:</b></p>
                            <p>{{profile.my_gigs}}</p>
                        </div>
                        <div class="col-3">
                            <p class="text-center"><b>No:</b></p>
                            <p class="text-center"> {{profile.num_gigs}}</p>
                        </div>
                        <br>
                    </div>
                    {% endif %}
                </div>

观看次数:

def my_gigs(request):
    profile = Profileuser.objects.get(user=request.user)
    template = 'profileusers/my_gigs.html'
    context = {
        'profile': profile,
    }
    return render(request, template, context)

def create_gig(request):
    profile = Profileuser.objects.get(user=request.user)
    template = 'profileusers/create_gig.html'
    context = {
        'profile': profile,
    }
    return render(request, template, context)

型号:

def my_gigs(self):
    return self.gig_set.all()

@property
def num_gigs(self):
    # pylint: disable=maybe-no-member
    return self.gig_set.all().count() 

您遍历 gigs,因此:

<p>{% for <strong>gig in</strong> profile.my_gigs %}{{ gig }} {% endfor %}</p>

在这种情况下,它将进行查询,并枚举包含在查询集中的 Gig。然后每个 gig 单独呈现。