Reputation: 3977
Imagine a Page model:
class ItemPage(Page):
featured = models.BooleanField(default=False)
priority = models.IntegerField(default=0)
This is model is served by Wagtail, on the url given by structure or the website (all instances are on the same place), for example:
/items/1
/items/2
...
I would like to create a different path template, that would lead to the different template (same model, same data, different HTML/JS/CSS):
/items-different-view/1
/items-different-view/2
...
I can use the Django mechanism for this - create a regex pattern in urls.py
that triggers a custom function that returns HTTP response (the other template filled with data of the particular instance).
But is there some more Wagtail way how to do it directly in the model without creation outlaying URLs and view function?
Upvotes: 1
Views: 622
Reputation: 3108
Override get_template()
on your Page
definition.
Reference:
Upvotes: 0