PK ÍfCêñ¤ + django-tailordev-contact-0.3/searchindex.jsSearch.setIndex({objects:{},terms:{recipi:1,code:1,partial:1,prefix:1,via:1,follow:1,redirect:1,content:[0,1],onli:1,submit:1,depend:[0,1],render:1,also:1,configur:[0,1],send:1,should:1,add:1,contact_form_rul:1,local:1,applic:1,sourc:1,ceo:1,initi:1,framework:1,therebi:1,"new":1,report:1,now:1,requir:1,enabl:1,tailordev:[0,1],like:1,button:1,tran:1,list:1,method:1,td_contact_form_rul:1,user_contact_form_by_slug:1,each:1,small:1,div:1,where:1,page:1,pleas:1,set:1,myuser:1,runtest:1,design:1,opportun:1,our:1,successfulli:1,subject:1,compat:1,statu:1,installed_app:1,appear:1,pattern:1,someth:1,asid:1,label:1,current:1,estim:1,adapt:1,"import":1,foo:1,email:1,altern:1,core:1,run:[0,1],urlpattern:1,kei:1,"_layout":1,free:1,job:1,base:1,dictionari:1,post:1,slug:1,user_contact_form_by_pk:1,action:1,improv:1,com:1,block:1,first:1,form_wrapp:1,csrf_token:1,own:1,repositori:1,directli:1,point:1,feel:1,foundat:1,zurb:1,href:1,coverag:1,visibl:1,home:1,instal:[0,1],is_hidden:1,txt:1,your:1,contact_recipi:1,from:1,messag:1,field_wrapp:1,regist:1,two:1,been:1,contact_form:1,websit:1,includ:1,type:1,more:1,form:1,python:1,peopl:1,part:1,els:1,must:1,user_contact_form_by_id:1,"default":1,setup:1,work:1,exampl:1,project:1,defin:1,can:1,error:1,overrid:1,customiz:1,creat:1,look:1,favorit:1,partnership:1,templat:[0,1],tag:1,inherit:1,want:1,close:1,pip:1,partner:1,fill:1,welcom:0,custom:1,when:1,note:1,field:1,html:1,rememb:1,test:[0,1],you:1,document:0,simpl:1,noth:1,product:1,gener:1,intend:1,endfor:1,eleg:1,clone:1,time:1,alert:1,user:1,mai:1,td_contact:1,data:1,"class":1,dom:1,url:[0,1],request:1,rule:1,django:[0,1],inform:1,contact:[0,1],thi:1,endif:1},objtypes:{},titles:["Welcome to TailorDev Contact’s documentation!","Django TailorDev Contact"],objnames:{},filenames:["index","quickstart"]})PK ÍfC*#” ( django-tailordev-contact-0.3/search.html
A customizable contact form for your django projects.
For now, Django>=1.5 is the only dependency for this project to run on production, with python>=2.6. Currently, this application is not compatible with python 3.3. We are working on it.
To install TailorDev Contact, use pip:
$ pip install django-td-contact
If you intend to test or improve this application, first clone this repository and install the local dependencies:
$ pip install -r requirements/local.txt
Add td_contact and its dependencies to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'td_contact',
...
)
Add td_contact urls to your project url patterns:
urlpatterns = patterns('',
...
url(r'^contact/', include('td_contact.urls')),
...
)
Set your td_contact rules in your settings.py, by adding something like:
# Contact form
TD_CONTACT_FORM_RULES = {
'default': {
'prefix': "[Foo:contact]",
'subject': "General informations",
'to': ('contact@foo.com', 'ceo@foo.com'),
},
'partner': {
'prefix': "[Foo:partner]",
'subject': "Partnership opportunity",
'to': ('partner@foo.com', ),
},
'jobs': {
'prefix': "[Foo:jobs]",
'subject': "Job opportunity",
'to': ('jobs@foo.com', ),
},
}
TD_CONTACT_FORM_RULES is a simple dictionary where each key defines a new rule. Each rule is also a dictionary defining the email prefix & subject and the recipient list.
Important note : when a contact form has been successfully filled, the user is redirected to the website home page. Thereby, we use the django messages framework to inform our user of its request status. Remember to enable messages and add something like the following to your base template DOM:
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li data-alert{% if message.tags %} class="message {{ message.tags }}"{% endif %}>
{{ message }}
<a href="#" class="close">×</a>
</li>
{% endfor %}
</ul>
{% endif %}
This example works with the zurb foundation framework. Feel free to adapt this for your favorite framework.
TailorDev Contact form defines 3 urls you may use in your templates:
This url has been designed to initialize your form with your own rule, e.g.:
{% url 'contact_form_rule' 'jobs' %}
Depending on your application, people may want to contact a registered user directly and you want an elegant url to point to. To do so, use the user_contact_form_by_slug in your templates, e.g.:
{% url 'user_contact_form_by_slug' myuser.slug %}
Alternatively, use the user_contact_form_by_id in your templates, like:
{% url 'user_contact_form_by_pk' myuser.pk %}
This base url points to your contact form. Nothing more to add.
If you want to use our default templates, feel free to do so. But please note that:
The template-to-override used to render the form is visible as contact/form.html. The core part of the template may looks like:
<div class="form_wrapper">
<h1>{% trans "Contact" %}</h1>
{% if recipient %}
{% include "contact/partials/contact_recipient.html" %}
{% endif %}
<form action="" method="post" class="custom">
{% csrf_token %}
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<div class="field_wrapper">
<div class="field{% if field.field.required %} required{% endif %}">
<label {% if field.errors %}class="error"{% endif %}>{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<small class="error">{{ field.errors }}</small>
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
<button type="submit" />{% trans "Send message" %}</button>
</form>
</div>
Contents: