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.5.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.5.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_integrations-0.5.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.12

File hashes

Hashes for django_integrations-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c503b1a167cc786ae23010218462d43e9addfa4b515daf1c3cf63c1dcc8f9afe
MD5 a0c138c22d1fe647c1e2651df81b98f1
BLAKE2b-256 e79b26e41ed1a845eb0f24fed431ec281613eb6ff4d8df6941372f8ccb03da4d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_integrations-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 992c5f76ae8b1d132ec12dfa42a9e14f483c3891c4dffaf9892e026455207bbe
MD5 23c22db5a950a9fda412b74f8ce617c9
BLAKE2b-256 863d85f6cf6ce9b1beebf6d275c9e30c02bc8f9770e9d3eebd0b6c6f356f3ec1

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_integrations-0.5.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