.. image:: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20CI/badge.svg
:target: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20CI/badge.svg
:alt: Django Integrations CI
.. image:: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20Develop/badge.svg
:target: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20Develop/badge.svg
:alt: Django Integrations CI
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 <https://github.com/orcasgit/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
------------
.. code-block::
> 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:
.. code-block::
pip install -e .[dev]
Then run the migration command inside the develop folder
.. code-block::
./manage.py migrate
finally create a super user:
.. code-block::
./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.
.. code-block::
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.
.. code-block::
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)
Raw data
{
"_id": null,
"home_page": "https://github.com/renderbox/django-integrations/",
"name": "django-integrations",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "django,app",
"author": "Grant Viklund, Roberto Himmelbauer",
"author_email": "renderbox@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d1/54/397e23164a427f7e0dfc8496607dbb553f3357562acad6b7523eb8da9918/django-integrations-0.1.4.tar.gz",
"platform": null,
"description": "\n\n.. image:: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20CI/badge.svg\n :target: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20CI/badge.svg\n :alt: Django Integrations CI\n\n\n\n.. image:: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20Develop/badge.svg\n :target: https://github.com/renderbox/django-integrations/workflows/Django%20Integrations%20Develop/badge.svg\n :alt: Django Integrations CI\n\n\nDjango Integrations\n===================\n\nTools for creating and managing multi-site integrations like API Keys and Tokens\n\nPrerequisites\n-------------\n\nThis pakcage makes use of Encrypted Fields that come form the `django-fernet-fields <https://github.com/orcasgit/django-fernet-fields>`_ packages. Make sure to checkout their documentation for any questions related to Field Encryption. \n\nThis 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.\n\nInstallation\n------------\n\n.. code-block::\n\n > pip install django-integration\n\nFor Developers\n--------------\n\nMake sure you run the following command to ensure you have all the requirements needed to us the develop example project:\n\n.. code-block::\n\n pip install -e .[dev]\n\nThen run the migration command inside the develop folder\n\n.. code-block::\n\n ./manage.py migrate\n\nfinally create a super user:\n\n.. code-block::\n\n ./manage.py createsuperuser\n\nExample\n^^^^^^^\n\nIn 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.\n\nFor 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.\n\n.. code-block::\n\n class ZoomForm(forms.ModelForm):\n\n class Meta:\n model = Credential\n fields = ['public_key', 'private_key']\n labels = {\n 'public_key': \"Zoom Key\",\n 'private_key': \"Zoom Secret\"\n }\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.fields['public_key'].required = True\n self.fields['private_key'].required = True\n\nIt 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.\n\n.. code-block::\n\n class ZoomFormView(FormView):\n template_name = \"core/form.html\"\n form_class = ZoomForm\n success_url = reverse_lazy('integration-list')\n\n def form_valid(self, form):\n zoom = form.save(commit=False)\n zoom.name = 'Zoom Integration'\n zoom.site = Site.objects.get_current()\n zoom.save()\n return super().form_valid(form)\n\n\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Tools for creating and managing multi-site integrations like API Keys and Tokens",
"version": "0.1.4",
"split_keywords": [
"django",
"app"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9aab65c4fc4ead2aa7d3f866e5a05a27",
"sha256": "4363ce32442a3b4299d73f632f5fddc37eb88998999b661b7cb26147b0100244"
},
"downloads": -1,
"filename": "django_integrations-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9aab65c4fc4ead2aa7d3f866e5a05a27",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6252,
"upload_time": "2022-03-31T21:23:13",
"upload_time_iso_8601": "2022-03-31T21:23:13.992791Z",
"url": "https://files.pythonhosted.org/packages/12/cf/7d7d3eb35bf5595fa58a258f704da15ca1c00b7c2496394267239eb1d30f/django_integrations-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "0b00c88d8528ed2a996beea4e86e6545",
"sha256": "625dbda45ac145ee64eafff7c091b8715050155cba9df08f343848563ae2410f"
},
"downloads": -1,
"filename": "django-integrations-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "0b00c88d8528ed2a996beea4e86e6545",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5211,
"upload_time": "2022-03-31T21:23:15",
"upload_time_iso_8601": "2022-03-31T21:23:15.395117Z",
"url": "https://files.pythonhosted.org/packages/d1/54/397e23164a427f7e0dfc8496607dbb553f3357562acad6b7523eb8da9918/django-integrations-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-03-31 21:23:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "renderbox",
"github_project": "django-integrations",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "asgiref",
"specs": [
[
"==",
"3.5.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2021.10.8"
]
]
},
{
"name": "cffi",
"specs": [
[
"==",
"1.15.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"2.0.12"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"36.0.2"
]
]
},
{
"name": "defusedxml",
"specs": [
[
"==",
"0.7.1"
]
]
},
{
"name": "dj-database-url",
"specs": [
[
"==",
"0.5.0"
]
]
},
{
"name": "Django",
"specs": [
[
"==",
"3.2.12"
]
]
},
{
"name": "django-allauth",
"specs": [
[
"==",
"0.50.0"
]
]
},
{
"name": "django-crispy-forms",
"specs": [
[
"==",
"1.14.0"
]
]
},
{
"name": "django-extensions",
"specs": [
[
"==",
"3.1.5"
]
]
},
{
"name": "django-fernet-fields",
"specs": [
[
"==",
"0.6"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.3"
]
]
},
{
"name": "oauthlib",
"specs": [
[
"==",
"3.2.0"
]
]
},
{
"name": "psycopg2-binary",
"specs": [
[
"==",
"2.9.3"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.21"
]
]
},
{
"name": "PyJWT",
"specs": [
[
"==",
"2.3.0"
]
]
},
{
"name": "python3-openid",
"specs": [
[
"==",
"3.2.0"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2022.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.27.1"
]
]
},
{
"name": "requests-oauthlib",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.4.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"1.26.9"
]
]
}
],
"lcname": "django-integrations"
}