geoAndrew
geoAndrew

Reputation: 387

Should I use Wagtail for all models in a Django app?

I’m in the process of building a new webapp which uses Wagtail. This is an architecture question.

There will be the standard About, Terms of Service, and Blog pages. All of which fit in with the Wagtail paradigm very nicely. The rest of the site content is location-based information about specific types of businesses. Think of a FourSquare type app. The data for these pages will be very structured, be updated via user-facing webpages and a mobile app, and be JavaScript heavy.

For the regular Wagtail pages, there may be hundreds over time. For the location page types there will be (hopefully) tens of thousands of pages that will be nested to a max of four levels.

From a site-wide feature perspective, I’m looking to leverage Wagtail features like sitemaps and Elastic Search.

My question is, should I use the wagtail Page class for my location based pages?

Pros:

Cons:

If I went the non-wagtail route, is it possible to add non-wagtail models to the search index?

Are there other issues I should consider in this choice?

Upvotes: 3

Views: 779

Answers (1)

Loïc Teixeira
Loïc Teixeira

Reputation: 1434

Any Django model can be indexed and searched by inherit from index.Indexed and defining search_fields onto the model.

As for using pages or not, as always it depends on many things. However, it looks like it would make sense to keep your location model as such, not make it a page and expose in in the admin (either Django Admin if you need some extensions that already exists there, or Wagtail's modeladmin otherwise). Then you would create a LocationIndexPage which implements the RoutablePageMixin to dynamically serve the LocationPages. The page won't exists in the admin tree but will be reachable anyway.

Upvotes: 2

Related Questions