Skip to main content

Django models to allow Admin-accessible global site parameters

Project description

Site Parameters

Site Parameters is a simple Django app to store customized site-level content, so that it can be maintained from the Admin by content managers.

This includes:

  • Basic "key, value" settings for common data types;
  • Simple Navigation menus;
  • Management of Social Media locations for the site.

All data are available to all templates through a context processor.

As an example, you can have your site's copyright message as a SiteParameterString object rather than hard-coding it into a global footer template. Or, you can upload a "site canonical image" that would be used as a placeholder in situations where an image in a template isn't available.

Quick start

  1. Add "site_parameters" to your INSTALLED_APPS setting like this::

  2. Add the context_processors to the system context_processors in the settings file like this::

                'OPTIONS': {
                        'context_processors': [
  3. Run python migrate to create the database tables.

  4. Start the development server and visit to see the available models.

Basic Site Parameters

You can add site parameters of the following types:

  • Integers
  • Strings
  • Text blocks
  • URLs
  • Switches (booleans)
  • Images

(At present, there's no Markdown or HTML support as both of these would require other components to be installed.)

In general, each has the following fields:

  • Title
  • Slug (automatically generated from the title, but can be over-ridden)
  • Value

The title (for the most part) is just to make it easy to remember what the parameter is for (although it can be used in templates, etc. in the "regular" way).

The slug is what's used in the global context for all templates. Any hyphens are converted to underscores. So if you have a Site: String with:

  • title = "Copyright Notice"
  • slug = "copyright-notice", and
  • value = "2019 Skepsis Interplanetary"

then you can use {{ site_parameter_string.copyright_notice }} in any template.

Social Media

The Social Media model holds information about your site's external social media pages. This is a convenience for being able to, e.g., manage lists of social media icons on pages, easily add or delete them as new services emerge and become popular, etc.

Each of the items in the Social Media list have a field to enter an SVG icon.

The "Order in List" field handles ordering.

The "Available" field handles which items will be shown on the site.

In templates, you can access the information from {{ global_social_media_dict.slug }}.


Navigation Menus are constructed by assembling sets of Navigation Items. You can have as Navigation Menus as you need.

If you are also using Django CMS: the URL Slug field can be used to reference CMS Page objects. Otherwise you can put in a root-relative URL in the Internal Link field.

The ordered list of navigation items can be accessed in a template from the context name global_nav_ + slug, e.g., global_nav_footer.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-site-parameters, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size django_site_parameters-0.1.4-py3-none-any.whl (15.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-site-parameters-0.1.4.tar.gz (10.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page