32
31
form.cleaned_data['inquiry']])
33
32
sender = 'legal_note@widelands.org'
35
## get email addresses which are in a tuple of ('name','email'),
34
## get email addresses which are in form of ('name','email'),
37
36
for recipient in INQUIRY_RECIPIENTS:
38
37
recipients.append(recipient[1])
38
print('recipeients: ', recipients)
40
40
send_mail(subject, message, sender,
41
41
recipients, fail_silently=False)
45
45
form = ContactForm() # An unbound form
47
47
return render(request, 'mainpage/legal_notice.html', {
49
'inquiry_recipients': INQUIRY_RECIPIENTS,
51
52
def legal_notice_thanks(request):
52
53
return render(request, 'mainpage/legal_notice_thanks.html')
55
from forms import RegistrationWithCaptchaForm
56
from registration.backends.default import DefaultBackend
59
def register(request):
60
"""Overwritten view from registration to include a captcha.
62
We only need this because the remote IP addr must be passed to the
63
form; the registration doesn't do this
66
remote_ip = request.META['REMOTE_ADDR']
67
if request.method == 'POST':
68
form = RegistrationWithCaptchaForm(remote_ip, data=request.POST,
71
new_user = DefaultBackend().register(request, **form.cleaned_data)
72
return HttpResponseRedirect(reverse('registration_complete'))
74
form = RegistrationWithCaptchaForm(remote_ip)
76
return render_to_response('registration/registration_form.html',
77
{'registration_form': form},
78
context_instance=RequestContext(request))
55
from wlprofile.models import Profile
56
from registration.backends.hmac.views import RegistrationView
57
from django.contrib.auth.models import User
59
class OwnRegistrationView(RegistrationView):
61
Overwriting the default function to save also the extended User model (wlprofile)
63
def create_inactive_user(self, form):
65
Additionally save the custom enxtended user data.
67
new_user = form.save(commit=False)
68
new_user.is_active = False
70
reg_user = User.objects.get(username=new_user)
71
ext_profile = Profile(user=reg_user)
74
self.send_activation_email(new_user)
81
78
def developers(request):
82
79
"""This reads out some json files in the SVN directory, and returns it as a
83
80
wl_markdown_object.