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.4.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for django_integrations-0.4.0.tar.gz
Algorithm Hash digest
SHA256 93b1a7defefab3eaac43805d01b939b465469a7655cd7e159937e99b750b75f2
MD5 35a5b1e803f92b00f183f4e017ce187a
BLAKE2b-256 32800827ba25bf305fd73579eb33234a78813d57327830556c867147f2c0840d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_integrations-0.4.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.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_integrations-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bc3e11d59e88e9bdda21465a8e67780436ba9d758114401a494fb033f7783ef
MD5 870d3c806fb6a5426dedfce11f19a711
BLAKE2b-256 7b77b448118f7f07f36629797cf74d371bb54c4e7b707687437c45afed7f9f23

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_integrations-0.4.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 Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page