This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
249 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,3 @@ def homepage(request): | |
context = RequestContext(request) | ||
return render_to_response('homepage.html', context) | ||
|
||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,13 @@ | |
|
||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | ||
EMAIL_HOST = 'localhost' | ||
EMAIL_HOST_PASSWORD = '' | ||
EMAIL_HOST_USER = '' | ||
EMAIL_PORT = 25 | ||
|
||
|
||
ADMINS = ( | ||
# ('Your Name', '[email protected]'), | ||
) | ||
|
@@ -31,11 +38,11 @@ | |
# timezone as the operating system. | ||
# If running in a Windows environment this must be set to the same as your | ||
# system time zone. | ||
TIME_ZONE = 'America/Chicago' | ||
TIME_ZONE = 'America/Sao_Paulo' | ||
|
||
# Language code for this installation. All choices can be found here: | ||
# http://www.i18nguy.com/unicode/language-identifiers.html | ||
LANGUAGE_CODE = 'en-us' | ||
LANGUAGE_CODE = 'pt-br' | ||
|
||
SITE_ID = 1 | ||
|
||
|
@@ -95,8 +102,9 @@ | |
'django.contrib.sites', | ||
'django.contrib.messages', | ||
'core', | ||
'subscription', | ||
# Uncomment the next line to enable the admin: | ||
# 'django.contrib.admin', | ||
'django.contrib.admin', | ||
# Uncomment the next line to enable admin documentation: | ||
# 'django.contrib.admindocs', | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import datetime | ||
from django.contrib import admin | ||
from subscription.models import Subscription | ||
|
||
class SubscriptionAdmin(admin.ModelAdmin): | ||
list_display = ('name', 'email', 'phone', 'created_at', 'subscribed_today') | ||
date_hierarchy = 'created_at' | ||
search_fields = ('name', 'email', 'phone', 'cpf', 'created_at') | ||
list_filter = ['created_at'] | ||
|
||
def subscribed_today(self, obj): | ||
return obj.created_at.date() == datetime.date.today() | ||
|
||
subscribed_today.short_description = 'Inscrito hoje?' | ||
subscribed_today.boolean = True | ||
|
||
|
||
admin.site.register(Subscription, SubscriptionAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django import forms | ||
from subscription.models import Subscription | ||
|
||
class SubscriptionForm(forms.ModelForm): | ||
class Meta: | ||
model = Subscription | ||
exclude= ("created_at",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#coding: utf-8 | ||
|
||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
class Subscription(models.Model): | ||
name = models.CharField('Nome', max_length=100) | ||
cpf = models.CharField('CPF', max_length=11, unique=True) | ||
email = models.EmailField('E-mail', unique=True) | ||
phone = models.CharField('Telefone', max_length=20, blank=True) | ||
created_at = models.DateTimeField('Data inscrição', auto_now_add=True) | ||
|
||
def __unicode__(self): | ||
return self.name | ||
|
||
class Meta: | ||
ordering = ["created_at"] | ||
verbose_name = u"Inscrição" | ||
verbose_name_plural = u"Inscrições" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
This file demonstrates two different styles of tests (one doctest and one | ||
unittest). These will both pass when you run "manage.py test". | ||
Replace these with more appropriate tests for your application. | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
class SimpleTest(TestCase): | ||
def test_basic_addition(self): | ||
""" | ||
Tests that 1 + 1 always equals 2. | ||
""" | ||
self.failUnlessEqual(1 + 1, 2) | ||
|
||
__test__ = {"doctest": """ | ||
Another way to test that 1 + 1 is equal to 2. | ||
>>> 1 + 1 == 2 | ||
True | ||
"""} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.conf.urls.defaults import * | ||
|
||
urlpatterns = patterns('subscription.views', | ||
url(r'^$', 'subscribe', name='subscribe'), | ||
url(r'^(\d+)/sucesso/$', 'success', name='success'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# coding: utf-8 | ||
# Create your views here. | ||
|
||
from django.http import HttpResponseRedirect | ||
from django.shortcuts import render_to_response, get_object_or_404 | ||
from django.template import RequestContext | ||
from subscription.models import Subscription | ||
from subscription.forms import SubscriptionForm | ||
from django.core.urlresolvers import reverse | ||
from django.core.mail import send_mail | ||
|
||
def subscribe(request): | ||
if request.method == "POST": | ||
return create(request) | ||
else: | ||
return new(request) | ||
|
||
def new(request): | ||
form = SubscriptionForm() | ||
context = RequestContext(request, {'form':form}) | ||
return render_to_response('subscription/new.html', context) | ||
|
||
def create(request): | ||
form = SubscriptionForm(request.POST) | ||
if not form.is_valid(): | ||
context = RequestContext(request, {'form':form}) | ||
return render_to_response('subscription/new.html', context) | ||
|
||
subscription = form.save() | ||
send_subscription_confirmation(subscription) | ||
return HttpResponseRedirect(reverse('subscription:success', args=[subscription.pk])) | ||
|
||
def send_subscription_confirmation(subscription): | ||
send_mail( | ||
subject = u'EventeX - Confirmação de inscrição', | ||
message = u'{0}, obrigado por se inscrever no EventeX!'.format(subscription.name), | ||
from_email = "[email protected]", | ||
recipient_list = [subscription.email], | ||
) | ||
|
||
def success(request, pk): | ||
subscription = get_object_or_404(Subscription, pk=pk) | ||
context = RequestContext(request, {'subscription':subscription}) | ||
return render_to_response('subscription/success.html', context) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,14 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<!-- | ||
Design by Free CSS Templates | ||
http://www.freecsstemplates.org | ||
Released for free under a Creative Commons Attribution 2.5 License | ||
Name : Milestone | ||
Description: A two-column, fixed-width design for 1024x768 screen resolutions. | ||
Version : 1.0 | ||
Released : 20100309 | ||
--> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<title>EventeX</title> | ||
<meta name="keywords" content="" /> | ||
<meta name="description" content="" /> | ||
<link href="{{ MEDIA_URL }}style.css" rel="stylesheet" type="text/css" media="screen" /> | ||
</head> | ||
<body> | ||
<div id="logo"> | ||
<h1><a href="#">EventeX</a></h1> | ||
<p><em>Welcome to the Django</a></em></p> | ||
</div> | ||
<hr /> | ||
<!-- end #logo --> | ||
<div id="header"> | ||
<div id="menu"> | ||
<ul> | ||
<li class="current_page_item"><a href="#" class="first">Home</a></li> | ||
<li><a href="#">Inscrições</a></li> | ||
<li><a href="#">Contato</a></li> | ||
<li><a href="#">Admin</a></li> | ||
</ul> | ||
</div> | ||
<!-- end #menu --> | ||
</div> | ||
<!-- end #header --> | ||
<!-- end #header-wrapper --> | ||
<div id="page"> | ||
<div id="content"> | ||
<div class="post"> | ||
<h2 class="title"><a href="#">Bem vindo ao EventeX!</a></h2> | ||
<div class="entry"> | ||
<p>O evento mais sensacional do ano depois do DevInRio!</p> | ||
<p>Você não pode perder esta oportunidade</p> | ||
<ul> | ||
<li>Abertura das inscrições em <strong>12/02/2011</strong> | ||
</ul> | ||
<p>Para dúvidas ou maiores informações entre em contato @ <a href="#">[email protected]</a> | ||
</div> | ||
</div> | ||
</div><!-- end #content --> | ||
<div style="clear: both;"> </div> | ||
</div> | ||
<!-- end #page --> | ||
<div id="footer"> | ||
<p>Copyleft (c) 2011 Gustavo Veloso. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p><center><a href="http://www.djangoproject.com/" target="_blank"><img src="http://media.djangoproject.com/img/badges/djangomade124x25.gif" border="0" alt="Made with Django." title="Made with Django." /></a></center> | ||
</div> | ||
<!-- end #footer --> | ||
</body> | ||
</html> | ||
{% extends 'master.html' %} | ||
{% block title %}Página inicial{% endblock title %} | ||
{% block content %} | ||
<h2 class="title"><a href="#">Bem vindo ao EventeX!</a></h2> | ||
<div class="entry"> | ||
<p>O evento mais sensacional do ano depois do DevInRio!</p> | ||
<p>Você não pode perder esta oportunidade</p> | ||
<ul> | ||
<li><a href="{% url subscription:subscribe %}"><strong>Inscreva-se já</strong></a></li> | ||
<li>Para dúvidas ou maiores informações contate-nos pelo <a href="mailto:[email protected]"> | ||
[email protected]</a> | ||
</ul> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<!-- | ||
Design by Free CSS Templates | ||
http://www.freecsstemplates.org | ||
Released for free under a Creative Commons Attribution 2.5 License | ||
Name : Milestone | ||
Description: A two-column, fixed-width design for 1024x768 screen resolutions. | ||
Version : 1.0 | ||
Released : 20100309 | ||
--> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<title>Eventex - {% block title %}{% endblock title %}</title> | ||
<meta name="keywords" content="" /> | ||
<meta name="description" content="" /> | ||
<link href="{{ MEDIA_URL }}style.css" rel="stylesheet" type="text/css" media="screen" /> | ||
</head> | ||
<body> | ||
<div id="logo"> | ||
<h1><a href="#">EventeX</a></h1> | ||
<p><em>Welcome to the Django</a></em></p> | ||
</div> | ||
<hr /> | ||
<!-- end #logo --> | ||
<div id="header"> | ||
<div id="menu"> | ||
<ul> | ||
<li><a href="#" class="first">Home</a></li> | ||
<li><a href="{% url subscription:subscribe %}">Inscrições</a></li> | ||
<li><a href="#">Contato</a></li> | ||
<li><a href="#">Admin</a></li> | ||
</ul> | ||
</div> | ||
<!-- end #menu --> | ||
</div> | ||
<!-- end #header --> | ||
<!-- end #header-wrapper --> | ||
<div id="page"> | ||
<div id="content"> | ||
<div class="post"> | ||
{% block content %} | ||
{% endblock content %} | ||
</div> | ||
</div><!-- end #content --> | ||
<div style="clear: both;"> </div> | ||
</div> | ||
<!-- end #page --> | ||
<div id="footer"> | ||
<p>Copyleft (c) 2011 Gustavo Veloso. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p><center><a href="http://www.djangoproject.com/" target="_blank"><img src="http://media.djangoproject.com/img/badges/djangomade124x25.gif" border="0" alt="Made with Django." title="Made with Django." /></a></center> | ||
</div> | ||
<!-- end #footer --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends 'master.html' %} | ||
{% block title %}Formulário de inscrição{% endblock title %} | ||
{% block content %} | ||
<h2 class="title"><a href="#">Formulário de Inscrição</a></h2> | ||
<div class="entry"> | ||
<form action="." method="POST"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input type="submit" value="Enviar"> | ||
</form> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends 'master.html' %} | ||
{% block title %}Inscrição efetuada com sucesso{% endblock title %} | ||
{% block content %} | ||
<h2 class="title"><a href="#">Inscrição efetuada com sucesso</a></h2> | ||
<div class="entry"> | ||
<p>Parabéns {{ subscription.name }}</p> | ||
<p>Sua inscrição foi processada corretamente em {{subscription.created_at|date:"d/M/Y" }}.</p> | ||
<p>Em breve alguém entrará em contato pelo | ||
{% if subscription.phone %} | ||
telefone {{subscription.phone }} | ||
{% else %} | ||
e-mail {{ subscription.email }} | ||
{% endif %}</p> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters