SaaS CMS has officially launched! Learn more now.

Per Nergård
Apr 18, 2016
  3233
(1 votes)

Limit block and page types to be created only once (updated)

Two years ago I did a hack that let you as a developer specify if a block or page type should be allowed to only be created once. Old post here. For some reason I can't remeber I used an interface to specify this. Now I have updated the code to use an attribute instead. 

Just decorate your models with [Singleton] and the initializationmodule will handle the rest.

Code over at Gist.

Apr 18, 2016

Comments

Please login to comment.
Latest blogs
Optimizely release SaaS CMS

Discover the future of content management with Optimizely SaaS CMS. Enjoy seamless updates, reduced costs, and enhanced flexibility for developers...

Andy Blyth | Jul 17, 2024 | Syndicated blog

A day in the life of an Optimizely Developer - London Meetup 2024

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024