How to do tags in django with mariadb

im trying to make a website and part of that is having tags much like this site has, do you have advice? rn im trying this

def index(request):
    storylist = Story.objects.order_by("id")
    tagslist = []
    for sto in storylist:
        tagslist.append(sto.tags.split(","))
    context = {"storylist": storylist,"tagslist":tagslist}
    return render(request, "storyage/index.html", context)

but

  1. its not working (i dont know how to make the specific tags show up with the specific story)

  2. deleting a story breaks the whole thing i feel

Вернуться на верх