1

I am making a website running wagtail as the CMS/backend and use Page for things that are actual web pages on the site. In addition to this I will need an Events section and I am unsure whether to make it as a Wagtail Page or Django models.Model.

The way I would like this to work for the user is to have an Events section in the admin panel using ModelAdmin so that the user can easily find and navigate to all Events, and, for those events to be displayed in various sections of the site - Home Page, Events Page, Article Page for example.

I think using Page for this and requiring the user to navigate to it (Home > Events Listing > Event Detail) each time is rather a waste of time and cumbersome as opposed to having it use ModelAdmin paired with Django models.Model and that being 1 or 2 clicks away.

Reading through my question it's obvious I am leaning towards using Django model for this, so my question is: what is the trade-off between the two? Is there a set use case for using one or the other? Would using one mean having more/less functionality over the other and what would those be?


Note: I know my question is almost identical to Guidelines for using Wagtail Pages or Django models? however it's more focused on ecommerce but most importantly it has no answer.

Freemium
  • 450
  • 6
  • 16
  • 2
    You could make them wagtail [snippets](https://docs.wagtail.io/en/v2.0/topics/snippets.html). That way, they will automatically appear in the wagtail backend to be edited. If your events have detail Pages (maybe automatically rendered by an app or EventListPage) you should consider to make them [indexed](https://docs.wagtail.io/en/v2.10.2/topics/search/indexing.html?highlight=indexable#wagtailsearch-indexing-models) so they show up in your search. – user2390182 Oct 09 '20 at 13:50
  • Thanks. I could, but I still don't know what the difference is between them. How would a snippet differ from the `ModelAdmin` way as they're both using `models.Model` and what are the different purposes of the two and `Page`. Also for the snippet, could it be used as a section within the admin, on page templates and inserted into pages or streamfields? Is that why you suggested it? – Freemium Oct 09 '20 at 14:09

1 Answers1

1

Use models.Model and register as a snippet because it will give you more flexibility.

As a user mentioned above, using a snippet is a great idea for what you're discussing. It's one click on the admin and they're in the event system. Then, you can just pass that model into the context for a page. Here's an example of doing this in Wagtail. See this example on adding snippets as streamfield if you wanted the customer to be able to place the events manually through the CMS.

Hayden
  • 498
  • 2
  • 5
  • 18
  • I have created it as a snippet, as it would be good to use in articles/streamfield, and plugged it into the model admin. How would I then have a page created for each event? I want to display x number of events on the home page. Then a separate Events Listing page with child Event Detail pages which display the full information about an event. Right now I have all except a way to display an individual event. – Freemium Oct 13 '20 at 14:57