Skip to content

Commit

Permalink
Merge e7ff3b5 into 20987d5
Browse files Browse the repository at this point in the history
  • Loading branch information
ikresoft committed Jan 28, 2014
2 parents 20987d5 + e7ff3b5 commit 677f2d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions envelope/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@

SUBJECT_INTRO = getattr(settings, 'ENVELOPE_SUBJECT_INTRO',
_("Message from contact form: "))

BASE_TEMPLATE = getattr(settings, 'ENVELOPE_BASE_TEMPLATE', 'base.html')
2 changes: 1 addition & 1 deletion envelope/templates/envelope/contact.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layout.html" %}
{% extends base_template %}
{% load i18n %}

{% load envelope_tags %}
Expand Down
13 changes: 10 additions & 3 deletions envelope/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic import FormView
from django.conf import settings

from envelope import signals
from envelope import signals, settings as envelope_settings
from envelope.forms import ContactForm


Expand Down Expand Up @@ -60,6 +61,11 @@ class ContactView(FormView):
template_name = 'envelope/contact.html'
success_url = None

def get_context_data(self, *args, **kwargs):
context = super(ContactView, self).get_context_data(*args, **kwargs)
context["base_template"] = envelope_settings.BASE_TEMPLATE
return context

def get_success_url(self):
"""
Returns the URL where the view will redirect after submission.
Expand All @@ -77,10 +83,11 @@ def get_initial(self):
user = self.request.user
if user.is_authenticated():
# the user might not have a full name set in the model
username = user.get_username() if getattr(settings, 'AUTH_USER_MODEL', None) is not None else user.username
if user.get_full_name():
sender = '%s (%s)' % (user.username, user.get_full_name())
sender = '%s (%s)' % (username, user.get_full_name())
else:
sender = user.username
sender = username
initial.update({
'sender': sender,
'email': user.email,
Expand Down

0 comments on commit 677f2d8

Please sign in to comment.