Django Namek is a Django app for forms chaining with some features :
Manage Django forms in Django session
Reuse generic views : IndexView, ValidationView and ResultsView
Perform an action with the results of the forms
Tests written with Selenium
Setup
1 - Install with pip :
pip install django_namek
2 - Create your forms
from django import forms
from django_namek import abstract
class LocationForm(abstract.Form):
display_name = "Location"
slug = "location"
address_line = forms.CharField(
label='Adresse',
max_length=100
)
zip_code = forms.CharField(
label='Postal Code',
max_length=5
)
city = forms.CharField(
label='City',
max_length=100
)
3 - Create your workflows
from django_namek import abstract
from . import forms
class PersonWorkflow(abstract.WorkflowView):
display_name = 'Person'
slug = 'person'
forms = [
forms.LocationForm,
forms.ActivityForm,
]
class CompanyWorkflow(abstract.WorkflowView):
display_name = 'Company'
slug = 'company'
forms = [
forms.LocationForm,
forms.ActivityForm,
]
4 - Create an action :
import hashlib
from django_namek.actions import Action
class Md5(Action):
def run(self):
address_line = self.session.get_field('address_line', '')
zip_code = self.session.get_field('zip_code', '')
city = self.session.get_field('city', '')
activity = self.session.get_field('activity', ['empty'])
md5 = hashlib.md5()
md5.update(address_line.encode())
md5.update(zip_code.encode())
md5.update(city.encode())
md5.update(activity[0].encode())
self.res['md5'] = md5
5 - Change your Django settings.py. For more customization, take a look at constants.py :
INSTALLED_APPS = [
...
'django_namek',
]
...
SESSION_ENGINE = "django_namek.session"
DN_WORKFLOWS = [
'tests.views.PersonWorkflow',
'tests.views.CompanyWorkflow',
]
DN_BASE_URL = "http://localhost:4243"
DN_ACTION_CLASS = "tests.actions.Md5"
6 - Add Django Namek urls :
from django.urls import include, path
urlpatterns = [
...
path('', include('django_namek.urls', namespace='django_namek'))
]
Optional : configure an email backend with django for validation view (example with anymail[sendgrid]) :
ANYMAIL = {
"SENDGRID_API_KEY": xxxxxx,
}
EMAIL_BACKEND = "anymail.backends.sendgrid.EmailBackend"
DEFAULT_FROM_EMAIL = "mail@example.com"
SERVER_EMAIL = "mail@example.com"
Development env
git clone git@github.com:Aleksi44/django-namek.git pip install -r requirements.txt
Run Django Server
python manage.py migrate python manage.py init python manage.py runserver 0.0.0.0:4243
Tests
This test allows you to test all workflows with selenium :
python manage.py test django_namek.tests
Metadata
Release files for django-namek 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_namek-0.0.3.tar.gz | 28.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_namek-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.3 kB
Release files / django_namek-0.0.3.tar.gz
| Download URL | django_namek-0.0.3.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b0e1b87a2fcd1bd34ac0adb7c06422749a42ea281614216df39067c264e5652
|
|
BLAKE2b-256 checksum How to use checksums |
718fb5c34d886c09fb0ad03d36fad0645af03396386d2b0fa19e48597947d174
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9
|
Release files / django_namek-0.0.3-py3-none-any.whl
| Download URL | django_namek-0.0.3-py3-none-any.whl |
|---|---|
| Size | 35.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88e1163ad4993aec27f29d37c84db380711dd1bf606dd2678d12cc80b35ccae5
|
|
BLAKE2b-256 checksum How to use checksums |
b3c96d4225b25446f052a369be94fca07d2d19ec198f2443bd334753debcb830
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9
|
Security for django-namek 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.