Skip to main content

ggds-django

The Ghana Government Design System (GGDS) for Django: the page parts as template tags, a form renderer that turns any Django form into GGDS markup with correct error handling, the GGDS styles, themes and script as static files, and GGDS colours and header for Django admin. Django 5.0 or later. Works with Wagtail and other Django-based CMSs.

Documentation: ghana-gds.github.io/ggds · Use it with Django · Versions and support

Set up

INSTALLED_APPS = [..., "django.contrib.staticfiles", "ggds_django"]
FORM_RENDERER = "ggds_django.forms.GGDSFormRenderer"   # every form in GGDS markup
TEMPLATES = [{..., "OPTIONS": {"context_processors": [..., "django.template.context_processors.request"]}}]

To use GGDS for some forms only, leave FORM_RENDERER out and add GGDSFormMixin to those forms.

A page

{% load ggds %}<!doctype html>
<html lang="en-GB">
<head>
  <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{% ggds_error_title form "Make a complaint" %} | Example Agency</title>
  {% ggds_assets theme="<theme>" %}
</head>
<body>
{% ggds_skip_link %}
{% ggds_banner short_name="EA" host="example.gov.gh" official=is_official %}
{% ggds_header name="Example Agency" nav=nav %}
<main id="main" tabindex="-1" class="ggds-container ggds-main">
  {% ggds_breadcrumbs crumbs %}
  <h1>Make a complaint</h1>
  <form method="post">{% csrf_token %}
    {{ form }}
    <button class="ggds-button">Send complaint</button>
  </form>
</main>
{% ggds_footer name="Example Agency" sections=sections links=footer_links %}
{% ggds_tab_bar tabs %}
</body>
</html>

Links are dicts ({"label": "Services", "href": "/services/"}) or ("Services", "/services/") pairs. The header marks the section the page's address is in; the tab bar marks the current tab.

Forms

With the renderer, {{ form }} shows an error summary after a failed submit (focused on load by the GGDS script, each item linking to its field, a radio group's to its first option), then every field:

Django widget GGDS markup
Text, email, number, date… ggds-field with label, hint (help_text), error and ggds-input
Textarea, Select, FileInput the same with ggds-textarea, ggds-select, ggds-file-upload
RadioSelect, CheckboxSelectMultiple a ggds-fieldset with a legend and ggds-choices
CheckboxInput a single ggds-choice
GGDSDateField a ggds-fieldset with day, month and year boxes (ggds-date-input)

Each control gets aria-describedby (hint, then error) and, with an error, aria-invalid="true". Errors start with a hidden "Error:". Fields that are not required say "(optional)". Set autocomplete on personal details with the widget's attrs. One field: {{ form.phone.as_field_group }}.

Dates people know

from ggds_django.forms import GGDSDateField

class ApplicationForm(forms.Form):
    date_of_birth = GGDSDateField(label="What is your date of birth?", name="date of birth", birthday=True,
                                  help_text="For example, 27 3 1990")

cleaned_data["date_of_birth"] is a datetime.date. The month can be typed as 3, 03, March or Mar. Errors use name: "Enter date of birth", "Date of birth must include a year", "Year must include 4 numbers", "Date of birth must be a real date", and with birthday=True or past=True, "Date of birth must be in the past". Only the boxes with the problem are marked invalid, and the error summary links to the first of them. birthday=True also adds autocomplete="bday-day" and so on.

Page parts

Tag
{% ggds_assets theme="<theme>" %} Stylesheet, theme and optional script, in <head>
{% ggds_skip_link %} First thing in <body>
{% ggds_banner short_name host official %} Government website banner
{% ggds_header name nav %} Logo or initials, name, sections, Search
{% ggds_hero title purpose lede search_action tasks %} Homepage hero
{% ggds_breadcrumbs crumbs %} Trail ending with the current page
{% ggds_summary_list rows %} Check answers: rows of {"key", "value", "href"}; an empty value shows "Not given", and each Change link says what it changes. plain=True for no lines
{% ggds_panel "Complaint sent" reference=ref %} Confirmation panel: the page's <h1> and the reference number
{% ggds_page_heading "Welcome back, Ama" eyebrow="..." lede="..." %} Page heading: the top of an inner page in the institution's colour, with the page's <h1>. danger=True for a warning in force
{% ggds_key_figures figures %} Key figures: dicts of {"value", "label"}, and optionally "change" (in words) and "danger": True. inverse=True on a page heading
{% ggds_progress 3 4 %} Progress: "Question 3 of 4" in words and as a native <progress>. label="Step 2 of 4: your canoe" to change the words
{% ggds_timeline stages %} Timeline: dicts of {"title", "when", "state"}, where state is "done", "current" or ""; each stage says its state to screen readers
{% ggds_meter value max=1100 %} Meter: an amount as a bar, for a table cell next to the number; hidden from screen readers
{% ggds_steps steps %} Steps: dicts of {"icon", "title", "text"}. urgent=True for an emergency; heading_level=2 if they sit under the <h1>
{% ggds_pagination page_obj %} From Django's Paginator; keeps other query parameters
{% ggds_footer name purpose address email phone sections links %} Footer
{% ggds_tab_bar tabs %} Phone quick links: each tab has an icon
{% ggds_error_summary form %} On its own, for forms you lay out yourself

Everything else (buttons, notices, tags, cards, tables) is plain GGDS HTML: copy it from the documentation.

Django admin

Admin keeps its own layout but takes GGDS's colours, type, focus style and header (the flag-colour rule and the institution's logo or initials, name and country), from the GGDS tokens and your institution's theme:

INSTALLED_APPS = [..., "ggds_django", "ggds_django.admin_theme", "django.contrib.admin", ...]  # above admin
GGDS_ADMIN = {
    "theme": "<theme>",                             # a file in ggds/themes/, as for {% ggds_assets %}
    "name": "Example Agency",                        # default: the admin site's site_header
    "initials": "EA",                               # or "logo_url" and "logo_alt"
    "country": "Republic of Ghana",                 # the default; "" for none
}

It loads the tokens on their own (ggds/tokens.css), never the GGDS base styles, which would restyle admin's elements. Admin is shown light only: the dark palette and the theme toggle are left out. manage.py check warns if the app is below django.contrib.admin, a key is misspelt or the theme does not exist.

Content added after load

HTMX, fetch or a script that adds a GGDS menu or error summary should call initAll(element) from the GGDS script (ggds/js/index.js) on the new content.

Develop

From the GGDS repository: pnpm run build copies the tokens, styles, themes, script and icons into the app; pnpm run test:django runs the tests (including a check that the markup matches the GGDS documentation) and renders an example site into the documentation build, where the accessibility tests check it.

Metadata

Release files for ggds-django 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ggds-django 0.3.0
File Size Uploaded Provenance Actions
ggds_django-0.3.0.tar.gz 106.3 kB With provenance Details for ggds_django-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ggds-django 0.3.0
File Interpreter ABI Platform Actions
ggds_django-0.3.0-py3-none-any.whl Python 3 none any Details for ggds_django-0.3.0-py3-none-any.whl

Total release size: 251.6 kB

Release files / ggds_django-0.3.0.tar.gz

Download URL ggds_django-0.3.0.tar.gz
Size 106.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5af7b1d5699b2bac0c0c06071683a612ee895c1c9c5b02ce6b0614820fd14962
BLAKE2b-256 checksum
How to use checksums
239e37f2372b52eec3736f8ca0f566ce5cf505c18bc6ce1ad5d836522a10d7e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / ggds_django-0.3.0-py3-none-any.whl

Download URL ggds_django-0.3.0-py3-none-any.whl
Size 145.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7666299545852e137339ee0f4b7867bc4c646ee5104762c2de39b61d9c6075f
BLAKE2b-256 checksum
How to use checksums
898463db5691582da3006f9eaef1b4eafaa76cdbe7ecc2bb5877c7a38353c1bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for ggds-django 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ggds_django-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page