Skip to main content

Tools for creating and managing multi-site integrations like API Keys and Tokens.

Project description

Python Tests

Publish Python 🐍 distribution 📦 to PyPI

Django Integrations

Tools for creating and managing multi-site integrations like API Keys and Tokens

Prerequisites

This pakcage makes use of Encrypted Fields that come form the django-fernet-fields packages. Make sure to checkout their documentation for any questions related to Field Encryption.

This package makes use of JSON fields so you'll need Download and install Postgresql. This will change with Django 3.1+ and the universal JSON field.

Installation

> pip install django-integration

For Developers

Make sure you run the following command to ensure you have all the requirements needed to us the develop example project:

pip install -e .[dev]

Then run the migration command inside the develop folder

./manage.py migrate

finally create a super user:

./manage.py createsuperuser

Example

In the develop django project you will find a core application that has three Forms each with its view to show case how to use the Credential Model in the integration package.

For example you have a ZoomForm to present the user with the fields Zoom gives to use their API with you project. The ZoomForm is responsible for presenting and validating the fields and linking it to the credentials Model just like a normal ModelForm would.

class ZoomForm(forms.ModelForm):

    class Meta:
        model = Credential
        fields = ['public_key', 'private_key']
        labels = {
            'public_key': "Zoom Key",
            'private_key': "Zoom Secret"
        }

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['public_key'].required = True
        self.fields['private_key'].required = True

It is in the view where it creates a Credential Model instance form the form submitted and saved. If you need to add additional fields or logic you can do it here, for example settting the site field in the Credential Model.

class ZoomFormView(FormView):
    template_name = "core/form.html"
    form_class = ZoomForm
    success_url = reverse_lazy('integration-list')

    def form_valid(self, form):
        zoom = form.save(commit=False)
        zoom.name = 'Zoom Integration'
        zoom.site = Site.objects.get_current()
        zoom.save()
        return super().form_valid(form)

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

django_integrations-0.2.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

django_integrations-0.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file django_integrations-0.2.0.tar.gz.

File metadata

  • Download URL: django_integrations-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for django_integrations-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4e671737ecdd1c2d38942150207a2fd7358dca3b799b292372bfed5b5e7fb327
MD5 c452f91e7d1a3a832418566709bb6438
BLAKE2b-256 35af6ae53126638efddf684e19c4e250d11015459dee72fad28bd40c46e1451f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_integrations-0.2.0.tar.gz:

Publisher: python-publish.yml on renderbox/django-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_integrations-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_integrations-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d94fce8df0ce4e9f20a4d8444bbcddc6de16a83555ce644eac2c11d4cb514ca
MD5 7e38e20e46416080ca0dcaf2932121e9
BLAKE2b-256 245b1354c6a144f8f1030c9c172d8d9093bc2e1cb38614d36245285f0a652ba7

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_integrations-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on renderbox/django-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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