def new(request): sign_form = SignForm() if request.POST: sign_form = SignForm(request.POST) if sign_form.is_valid(): sign_form.save() args = {} return render('done.html', args, context_instance=rc(request)) args = {'sign_form':sign_form} return render('new.html', args, context_instance=rc(request))
def view(request, character): character = get_or_404(Character, pk=character) i = Institute.objects.filter(characters__id=character.id)[0] args = { 'character' : character, 'institute' : i, } return render('view_character.html', args, context_instance=rc(request))
def view(request, id): wedding_id = None try: wedding = Wedding.objects.get(id=id) try: embed = BeautifulSoup(wedding.place_map) map_url = embed.iframe['src'] except: map_url = '' wedding_id = wedding.id gifts = Gift.objects.filter(wedding=wedding_id) args = {'wedding':wedding, 'map_url':map_url, 'gifts':gifts} return render('view.html', args, context_instance=rc(request)) except: wedding_id = id args = {'id':wedding_id} return render('new.html', args, context_instance=rc(request))
def index(req): if req.user.is_authenticated(): return redirect('/home/') login_facebook_url = 'https://graph.facebook.com/oauth/authorize?client_id=%s&redirect_uri=%s&scope=publish_stream,email' % (settings.APP_ID_FACEBOOK, settings.URL+'/login/facebook/') args = { 'login_facebook_url':login_facebook_url } return render('index.html', args, context_instance = rc(req))
def set_password(request, id): wedding = get_or_404(Wedding,pk=id,password='') if request.POST: wedding.password = hashlib.sha224(request.POST['password']).hexdigest() wedding.save() return redirect('/%s/panel/' % (wedding.id)) args = {} return render('set_password.html', args, context_instance=rc(request))
def create(request): if request.POST: institute = Institute.objects.create( name = request.POST['name'], alias = request.POST['alias'], image = request.FILES['image'] ) return redirect('/%s' % (institute.id)) args = {} return render('create_institute.html', args, context_instance=rc(request))
def new(request): if not request.GET.__contains__('id'): return HttpResponse('404') if Wedding.objects.filter(id=request.GET['id']).count()==0: wedding = Wedding.objects.create(id=request.GET['id']) else: args = { 'message':_(u'Lo sentimos, pero el sitio ya existe.') } return render('message.html', args, context_instance=rc(request)) return redirect('/%s/panel/set_password/' % (wedding.id))
def get_password(request, id): wedding = get_or_404(Wedding,pk=id) message = None if request.POST: password1 = hashlib.sha224(request.POST['password']).hexdigest() password2 = wedding.password if password1 == password2: return redirect('/%s/panel/' % (id)) else: message = _(u'Lo sentimos, password incorrecto, intenta de nuevo.') args = {'message':message} return render('get_password.html', args, context_instance=rc(request))
def create(request, institute): institute = get_or_404(Institute, pk=institute) if request.POST: character = Character.objects.create( name = request.POST['name'], alias = request.POST['alias'], image = request.FILES['image'] ) institute.characters.add(character) return redirect('/char/%s' % (character.id)) args = { 'institute': institute, } return render('create_character.html', args, context_instance=rc(request))
def info(req): if req.user.is_authenticated(): if len(req.user.email) is not 0: return redirect('/home/') if req.POST: req.user.email = req.POST['email'] errors = validate(req.POST['email']) if not errors: req.user.save() return redirect('/home/') return render('info.html', { 'user': req.user, 'errors': errors }) return render('info.html', {'user': req.user}, rc(req))
def panel(request, id): if not request.META.__contains__('HTTP_REFERER'): return redirect('/%s/panel/get_password/' % (id)) wedding = get_or_404(Wedding, pk=id) info_form = InfoForm(instance=wedding) if request.POST: info_form = InfoForm(request.POST, instance=wedding) if info_form.is_valid(): info_form.save() return redirect('/%s/panel/#info' % (wedding.id)) gifts = Gift.objects.filter(wedding=wedding.id) args = { 'gifts':gifts, 'info_form':info_form, 'wedding':wedding, } return render('panel.html', args, context_instance=rc(request))
def index(request): args = {'articles':Article.objects.all().order_by('date_creation')[:3]} return render('index.html', args, context_instance=rc(request))
def about(req): args = {} return render('about.html', args, context_instance = rc(req))
def index(request): weddings = Wedding.objects.all()[:5] args = {'id':wedding_code(), 'weddings':weddings} return render('index.html', args, context_instance=rc(request))
def new(req): args = {} return render('new.html', args, context_instance=rc(req))
def home(req): args = {} return render('home.html', args, context_instance=rc(req))
def index(request): args = { 'characters':Character.objects.all() } return render('characters.html', args, context_instance=rc(request))
def view(request, institute): args = { 'institute' : get_or_404(Institute, pk=institute), 'characters' : get_or_404(Institute, pk=institute).characters.all() } return render('view_institute.html', args, context_instance=rc(request))
def index(request): args = { 'institutes':Institute.objects.all() } return render('institutes.html', args, context_instance=rc(request))