Skip to content

🐛 [Bug]: Django template does not work with fiber.Map anymore #454

@chocolateimage

Description

@chocolateimage

Bug Description

I've upgraded to Fiber v3.0.0, but noticed all my pages had empty content.

After messing around I've found out that fiber.Map has changed to map[string]any. Manually changing it to map[string]interface{} from fiber.Map works.

I expected fiber.Map to still work in v3 because in the documentation it uses it to pass data.

This only happens in the Django engine, not using the HTML one.

How to Reproduce

Steps to reproduce the behavior:

  1. Install github.com/gofiber/fiber/v3 v3.0.0
  2. Install github.com/gofiber/template/django/v3 v3.1.14
  3. Paste the code snippet from the last section into main.go
  4. Create a views/index.html file with this content: A {{Title}} B

Expected Behavior

The template should display this like in v2:

A This is some content B

But it displays in v3:

A B

Template package Version

v3.1.14

Code Snippet (optional)

package main

import (
	"github.com/gofiber/fiber/v3"
	"github.com/gofiber/template/django/v3"
)

func main() {
	engine := django.New("./views", ".html")

	app := fiber.New(fiber.Config{
		Views: engine,
	})

	app.Get("/", func(c fiber.Ctx) error {
		return c.Render("index", fiber.Map{"Title": "This is some content"})
	})

	app.Listen(":3000")
}

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ☢️ BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions