fnp
/
edumed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6f53d65
)
Fixing contact form to work with katalog subdomain
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 18 Oct 2013 12:46:25 +0000
(14:46 +0200)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 22 Oct 2013 07:49:55 +0000
(09:49 +0200)
contact/forms.py
patch
|
blob
|
history
contact/templates/contact/mail_managers_body.txt
patch
|
blob
|
history
contact/templates/contact/thanks.html
patch
|
blob
|
history
contact/views.py
patch
|
blob
|
history
edumed/contact_forms.py
patch
|
blob
|
history
diff --git
a/contact/forms.py
b/contact/forms.py
index
e369e95
..
8fa0149
100644
(file)
--- a/
contact/forms.py
+++ b/
contact/forms.py
@@
-62,8
+62,8
@@
class ContactForm(forms.Form):
site = Site.objects.get_current()
dictionary = {
'form_tag': self.form_tag,
site = Site.objects.get_current()
dictionary = {
'form_tag': self.form_tag,
- 'site_name':
site.name
,
- 'site_domain':
site.domain
,
+ 'site_name':
getattr(self, 'site_name', site.name)
,
+ 'site_domain':
getattr(self, 'site_domain', site.domain)
,
'contact': contact,
}
context = RequestContext(request)
'contact': contact,
}
context = RequestContext(request)
diff --git
a/contact/templates/contact/mail_managers_body.txt
b/contact/templates/contact/mail_managers_body.txt
index
5088b1b
..
b7f97cf
100644
(file)
--- a/
contact/templates/contact/mail_managers_body.txt
+++ b/
contact/templates/contact/mail_managers_body.txt
@@
-1,6
+1,6
@@
-{% load pretty_print from contact_tags %}Wypełniono formularz {{ form_tag }} na stronie {{ site_name }}.
+{% load pretty_print from contact_tags %}
{% load subdomainurls %}
Wypełniono formularz {{ form_tag }} na stronie {{ site_name }}.
-
http://{{ site_domain }}{% url 'admin:contact_contact_change'
contact.pk %}
+
{% url 'admin:contact_contact_change' None
contact.pk %}
{% for k, v in contact.body.items %}
{{ k }}:
{% for k, v in contact.body.items %}
{{ k }}:
diff --git
a/contact/templates/contact/thanks.html
b/contact/templates/contact/thanks.html
index
63adb30
..
f82ebd8
100644
(file)
--- a/
contact/templates/contact/thanks.html
+++ b/
contact/templates/contact/thanks.html
@@
-1,4
+1,4
@@
-{% extends
form.
base_template|default:"base.html" %}
+{% extends base_template|default:"base.html" %}
{% load i18n %}
{% block title %}{% trans "Thank you" %}{% endblock %}
{% load i18n %}
{% block title %}{% trans "Thank you" %}{% endblock %}
diff --git
a/contact/views.py
b/contact/views.py
index
26ccf60
..
245433e
100644
(file)
--- a/
contact/views.py
+++ b/
contact/views.py
@@
-36,11
+36,14
@@
def form(request, form_tag):
def thanks(request, form_tag):
def thanks(request, form_tag):
- if form_tag not in contact_forms:
+ try:
+ form_class = contact_forms[form_tag]
+ except KeyError:
raise Http404
return render(request,
raise Http404
return render(request,
- ['contact/%s/thanks.html' % form_tag, 'contact/thanks.html']
+ ['contact/%s/thanks.html' % form_tag, 'contact/thanks.html'],
+ dict(base_template = getattr(form_class, 'base_template', None))
)
)
diff --git
a/edumed/contact_forms.py
b/edumed/contact_forms.py
index
e809e2b
..
ec34ebf
100644
(file)
--- a/
edumed/contact_forms.py
+++ b/
edumed/contact_forms.py
@@
-133,6
+133,7
@@
class MILForm(ContactForm):
from_title = 'Mil'
submit_label = _('Submit')
base_template = 'base_mil.html'
from_title = 'Mil'
submit_label = _('Submit')
base_template = 'base_mil.html'
+ site_name = site_domain = 'katalog.nowoczesnapolska.org.pl'
name = forms.CharField(label = _('Name and Surname'), max_length = 255)
contact = forms.EmailField(label = _('E-mail'), max_length = 255)
name = forms.CharField(label = _('Name and Surname'), max_length = 255)
contact = forms.EmailField(label = _('E-mail'), max_length = 255)