How it works...

The getattr(object, attribute_name[, default_value]) Python function tries to get the attribute_name attribute from object and returns default_value if it is not found. We try to read different settings from the Django project settings module or, if they don't exist there, the default values are used.

Note that we could have defined the choices for the theme field in models.py, but instead we created a custom ModelForm in administration and set the choices there. This was done to avoid the creation of new database migrations whenever the ARTICLE_THEME_CHOICES is changed.