Skip to main content

Giant Contact

A re-usable package which can be used in any project that requires a generic Contact app.

This will include the basic formatting and functionality such as model creation via the admin and email sending.

Installation

To install with the package manager, run:

$ poetry add giant-contact

You should then add "contact" to the INSTALLED_APPS in your settings file and to the Makefile.

In base.py there should also be a DEFAULT_FROM_EMAIL and a DEFAULT_TO_EMAIL. This is used by the email sending method.

Configuration

This application exposes the following settings:

  • DEFAULT_FROM_EMAIL is the From address in the email.

  • DEFAULT_TO_EMAIL is the default recipient. This is usually the client's address.

  • CONTACT_ABSOLUTE_URL allows the user to set a different URL as used in the get_absolute_url method

  • CONTACT_SUCCESS_URL allows the user to set a different success URL

  • CONTACT_EMAIL_TEMPLATE_HTML is the path to the email's HTML representation.

  • CONTACT_EMAIL_TEMPLATE_TXT is the path to the email's text representation.

  • CONTACT_ADMIN_LIST_DISPLAY is the field list for the admin index. This must be a list

  • CONTACT_ADMIN_FIELDSETS allows the user to define the admin fieldset. This must be a list of two-tuples

  • CONTACT_ADMIN_READONLY_FIELDS allows the user to configure readonly fields in the admin. This must be a list

  • CONTACT_FORM_FIELDS allows the user to customise what fields are displayed on the contact form. This must be a list

  • CONTACT_FORM_FIELD_PLACEHOLDERS allows the user to customise the field placeholder text. This must be a dict containing the fieldnames

  • CONTACT_FORM_REQUIRED_FIELDS allows the user to customise what fields are required on the contact form. This must be a list

  • CONTACT_FORM_LABELS allows the user to customise what the field labels are on the contact form. This must be a dict of field names and their corresponding label

  • CONTACT_FORM_WIDGETS allows the user to customise what the field widgets are on the contact form. This must be a dict of field names and their corresponding widget

URLs

Add the following to core.urls for general functionality:

path("contact/", include("contact.urls"), name="contact"),

If you want to customize the urls to include a different path and/or templates, first you must import contact.views in core.urls and then you could do add the following:

path("contact-us/", contact.views.EnquiryFormView.as_view({"template_name": "custom_template_name.html}), name=contact-us)
path("contact-us/success/", contact.views..SuccessView.as_view(), name=contact-success)

Context Processor

If you wish to use the Contact form with the context processor you will need to add contact.context_processors.enquiry_form into the TEMPLATES context processors list. This will allow you to access the form in templates.

Preparing for release

In order to prep the package for a new release on TestPyPi and PyPi there is one key thing that you need to do. You need to update the version number in the pyproject.toml. This is so that the package can be published without running into version number conflicts. The version numbering must also follow the Semantic Version rules which can be found here https://semver.org/.

Publishing

Publishing a package with poetry is incredibly easy. Once you have checked that the version number has been updated (not the same as a previous version) then you only need to run two commands.

$ `poetry build` 

will package the project up for you into a way that can be published.

$ `poetry publish`

will publish the package to PyPi. You will need to enter the username and password for the account which can be found in the company password manager

Metadata

Release files for giant-contact 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for giant-contact 0.6
File Size Uploaded Provenance Actions
giant-contact-0.6.tar.gz 10.3 kB Without provenance Details for giant-contact-0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for giant-contact 0.6
File Interpreter ABI Platform Actions
giant_contact-0.6-py3-none-any.whl Python 3 none any Details for giant_contact-0.6-py3-none-any.whl

Total release size: 25.4 kB

Release files / giant-contact-0.6.tar.gz

Download URL giant-contact-0.6.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7467f615e42e92474610712b701b7f5773a9282eb0b2eb3773a4d8be87106b3b
BLAKE2b-256 checksum
How to use checksums
298bf31237a6bbc9f6e7fbecb89812565df3ac0335595929d0cec9043d919755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/2.7.18 Linux/5.4.0-72-generic

Release files / giant_contact-0.6-py3-none-any.whl

Download URL giant_contact-0.6-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c91a0f29d353dc44721cbc79dcc93fb48c547b8ef522e3b773f8fbfc1a56a95
BLAKE2b-256 checksum
How to use checksums
7f37499f1ff82bf24ee2d24128145f85c7bbf465c6a588d266cd9223b1f266de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/2.7.18 Linux/5.4.0-72-generic

Security for giant-contact 0.6

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page