Package: giant-contact
Giant ContactA re-usable package which can be used in any project that requires a genericContactapp.This will include the basic formatting and functionality such as model creation via the admin and email sending.InstallationTo install with the package manager, run:$ poetry add giant-contactYou should then add"contact"to theINSTALLED_APPSin your settings file and to theMakefile.Inbase.pythere should also be aDEFAULT_FROM_EMAILand aDEFAULT_TO_EMAIL. This is used by the email sending method.ConfigurationThis application exposes the following settings:DEFAULT_FROM_EMAILis theFromaddress in the email.DEFAULT_TO_EMAILis the default recipient. This is usually the client's address.CONTACT_ABSOLUTE_URLallows the user to set a different URL as used in theget_absolute_urlmethodCONTACT_SUCCESS_URLallows the user to set a different success URLCONTACT_EMAIL_TEMPLATE_HTMLis the path to the email's HTML representation.CONTACT_EMAIL_TEMPLATE_TXTis the path to the email's text representation.CONTACT_ADMIN_LIST_DISPLAYis the field list for the admin index. This must be a listCONTACT_ADMIN_FIELDSETSallows the user to define the admin fieldset. This must be a list of two-tuplesCONTACT_ADMIN_READONLY_FIELDSallows the user to configure readonly fields in the admin. This must be a listCONTACT_FORM_FIELDSallows the user to customise what fields are displayed on the contact form. This must be a listCONTACT_FORM_FIELD_PLACEHOLDERSallows the user to customise the field placeholder text. This must be a dict containing the fieldnamesCONTACT_FORM_REQUIRED_FIELDSallows the user to customise what fields are required on the contact form. This must be a listCONTACT_FORM_LABELSallows the user to customise what the field labels are on the contact form. This must be a dict of field names and their corresponding labelCONTACT_FORM_WIDGETSallows the user to customise what the field widgets are on the contact form. This must be a dict of field names and their corresponding widgetURLsAdd the following tocore.urlsfor 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 importcontact.viewsincore.urlsand 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 ProcessorIf you wish to use the Contact form with the context processor you will need to addcontact.context_processors.enquiry_forminto theTEMPLATEScontext processors list. This will allow you to access the form in templates.Preparing for releaseIn 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 thepyproject.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 herehttps://semver.org/.PublishingPublishing 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