Skip to main content

Sync data between Wagtail and Airtable

Project description

An extension for Wagtail allowing content to be transferred between Airtable sheets and your Wagtail/Django models.

Developed by Torchbox and sponsored by The Motley Fool.

https://raw.githubusercontent.com/wagtail/wagtail-airtable/master/examples/preview.gif

View the repo README for more details

Installation & Configuration

  • Install the package with pip install wagtail-airtable

  • Add 'wagtail_airtable' to your project’s INSTALLED_APPS

  • In your settings you will need to map models to Airtable settings. Every model you want to map to an Airtable sheet will need:
    • An AIRTABLE_BASE_KEY. You can find the base key in your Airtable docs when you’re signed in to Airtable.com

    • An AIRTABLE_TABLE_NAME to determine which table to connect to.

    • An AIRTABLE_UNIQUE_IDENTIFIER. This can either be a string or a dictionary mapping the Airtable column name to your unique field in your model.
      • ie. AIRTABLE_UNIQUE_IDENTIFIER: 'slug', this will match the slug field on your model with the slug column name in Airtable. Use this option if your model field and your Airtable column name are identical.

      • ie. AIRTABLE_UNIQUE_IDENTIFIER: {'Airtable Column Name': 'model_field_name'}, this will map the Airtable Column Name to a model field called model_field_name. Use this option if your Airtable column name and your model field name are different.

    • An AIRTABLE_SERIALIZER that takes a string path to your serializer. This helps map incoming data from Airtable to your model fields. Django Rest Framework is required for this. See the [examples/](examples/) directory for serializer examples.

  • Lastly make sure you enable wagtail-airtable with WAGTAIL_AIRTABLE_ENABLED = True. By default this is disabled so data in your Wagtail site and your Airtable sheets aren’t accidentally overwritten. Data is hard to recover, this option helps prevent accidental data loss.

Example Base Configuration

Below is a base configuration or ModelName and OtherModelName (both are registered Wagtail snippets), along with HomePage.

# your settings.py
AIRTABLE_API_KEY = 'yourSuperSecretKey'
WAGTAIL_AIRTABLE_ENABLED = True
AIRTABLE_IMPORT_SETTINGS = {
    'appname.ModelName': {
        'AIRTABLE_BASE_KEY': 'app3ds912jFam032S',
        'AIRTABLE_TABLE_NAME': 'Your Airtable Table Name',
        'AIRTABLE_UNIQUE_IDENTIFIER': 'slug', # Must match the Airtable Column name
        'AIRTABLE_SERIALIZER': 'path.to.your.model.serializer.CustomModelSerializer'
    },
    'appname.OtherModelName': {
        'AIRTABLE_BASE_KEY': 'app4ds902jFam035S',
        'AIRTABLE_TABLE_NAME': 'Your Airtable Table Name',
        'AIRTABLE_UNIQUE_IDENTIFIER': {
            'Page Slug': 'slug', # 'Page Slug' column name in Airtable, 'slug' field name in Wagtail.
        },
        'AIRTABLE_SERIALIZER': 'path.to.your.model.serializer.OtherCustomModelSerializer'
    },
    'pages.HomePage': {
        'AIRTABLE_BASE_KEY': 'app2ds123jP23035Z',
        'AIRTABLE_TABLE_NAME': 'Wagtail Page Tracking Table',
        'AIRTABLE_UNIQUE_IDENTIFIER': {
            'Wagtail Page ID': 'pk',
        },
        'AIRTABLE_SERIALIZER': 'path.to.your.pages.serializer.PageSerializer',
        # Below are OPTIONAL settings.
        # By disabling `AIRTABLE_IMPORT_ALLOWED` you can prevent Airtable imports
        # Use cases may be:
        #   - disabling page imports since they are difficult to setup and maintain,
        #   - one-way sync to Airtable only (ie. when a model/Page is saved)
        # Default is True
        'AIRTABLE_IMPORT_ALLOWED': False,
        # Add the AIRTABLE_BASE_URL setting if you would like to provide a nice link
        # to the Airtable Record after a snippet or Page has been saved.
        # To get this URL open your Airtable base on Airtable.com and paste the link.
        # The recordId will be automatically added so please don't add that
        # You can add the below setting. This is optional and disabled by default.
        'AIRTABLE_BASE_URL': 'https://airtable.com/tblxXxXxXxXxXxXx/viwxXxXxXxXxXxXx',
    },
    # ...
}

View the repo README for more details

Project details


Download files

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

Source Distribution

wagtail-airtable-0.2.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

wagtail_airtable-0.2-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file wagtail-airtable-0.2.tar.gz.

File metadata

  • Download URL: wagtail-airtable-0.2.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.0 Darwin/18.7.0

File hashes

Hashes for wagtail-airtable-0.2.tar.gz
Algorithm Hash digest
SHA256 dd4932687c97b3a36709322a571dd7140aa2ebab5a8ddfab47ef22f94e7eacde
MD5 159dfc212378350f7ae2987cd4f5dccb
BLAKE2b-256 f662e841bf5baa0aff179e8e7f219e888d574f184f58c7b59c49428e9a4fa1bf

See more details on using hashes here.

Provenance

File details

Details for the file wagtail_airtable-0.2-py3-none-any.whl.

File metadata

  • Download URL: wagtail_airtable-0.2-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.0 Darwin/18.7.0

File hashes

Hashes for wagtail_airtable-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 54e74e7d8964fd4ee07225e136b919bea82752e4ac361026010f810434c10d38
MD5 81c16465137ea4a1aafd14c0d83bdd8f
BLAKE2b-256 d4aa7636185c68eb9fccb5d0097b3e08c69dd3addfc05d4318f781aa0b3171df

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page