--- /dev/null
+{% extends "base_super.html" %}
+
+{% block logo %}{% endblock %}
+{% block title %}Olimpiada cyfrowa{% endblock %}
+
+{% block body %}
+ <img src="http://edukacjamedialna.edu.pl/media/chunks/attachment/olimpiada_cyfrowa-srednie.png"/>
+ <h1>Tutaj będzie coś zajebistego!</h1>
+ <p>Podaj swój adres e-mail, żeby dostać powiadomienie:</p>
+ <form method="post" action="">
+ {% csrf_token %}
+ <label><input type="text" name="email"/></label>
+ <input type="submit" value="Wyślij">
+ </form>
+{% endblock %}
\ No newline at end of file
url(r'^info/(?P<url>.*)$', flatpage, name="info"),
url(r'^olimpiada/$', lambda request: flatpage(request, 'turniej/'), name='olimpiada'),
url(r'^olimpiada/(?P<url>.*)$', lambda request, url: flatpage(request, 'turniej/' + url), name='olimpiada'),
+ url(r'^olimpiada-teaser/$', 'edumed.views.olimpiada_teaser', name='olimpiada_teaser'),
url(r'^szukaj/', include('haystack.urls')),
url(r'^zglos/', include('contact.urls')),
url(r'^forum/profile/edit/$', AvatarlessProfileEditView.as_view(), name='edit_profile'),
# -*- coding: utf-8 -*-
from django.contrib.flatpages.views import flatpage
+from django.core.exceptions import ValidationError
+from django.core.validators import EmailValidator
+from django.http.response import HttpResponseRedirect
+from django.shortcuts import render_to_response
+from django.template.context import RequestContext
from django.views.defaults import page_not_found
from django.views.generic import TemplateView
from pybb.views import ProfileEditView
+from contact.models import Contact
from .forms import AvatarlessEditProfileForm
class AvatarlessProfileEditView(ProfileEditView):
form_class = AvatarlessEditProfileForm
+
+
+def olimpiada_teaser(request):
+ if request.POST:
+ email = request.POST.get('email')
+ try:
+ EmailValidator()(email)
+ Contact.objects.create(
+ contact=email,
+ body={},
+ ip=request.META['REMOTE_ADDR'],
+ form_tag='olimpiada-teaser')
+ except ValidationError:
+ pass
+ return HttpResponseRedirect(request.path)
+ return render_to_response('olimpiada_teaser.html', context_instance=RequestContext(request))