Created
May 8, 2012 15:13
-
-
Save pestefo/2636128 to your computer and use it in GitHub Desktop.
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
/******** Codigo que va en el {% block js%} del base.html ******/ | |
$('#Ingreso').ready(function(){ | |
$.ajaxSetup ({ | |
cache: false | |
}); | |
// ORIGINAL: var ajax_load = "<img src='img/load.gif' alt='loading...' />"; | |
// Imagen o texto a mostrar mientras carga la URL... podría ser un spinner o algo asi | |
var ajax_load = "<p>BUENAAAAAAA</p>"; | |
// Url a donde se va a dirigir | |
var loadUrl = "/login2/"; | |
$("#modal-body").html(ajax_load).load(loadUrl); | |
}); |
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
<form id="login_form" action="/login/" method="post" > | |
{% csrf_token %} | |
{{ form }} | |
<input type="submit" value="Ingresar"> | |
</form> |
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
from django.views.generic import FormView | |
from forms.user_login_form import UserLoginForm | |
## login_view.py esta en la carpeta mapu/ta/tierraadentro | |
class LoginView(FormView): | |
template_name = 'login2.html' | |
form_class = UserLoginForm | |
success_url = '/' # you should use `reverse`, but let's stay focused. | |
def form_valid(self, form): | |
""" | |
This is what's called when the form is valid. | |
""" | |
print "form valid!" | |
return super(MyView, self).form_valid(form) | |
def form_invalid(self, form): | |
""" | |
This is what's called when the form is invalid. | |
""" | |
return self.render_to_response(self.get_context_data(form=form)) |
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
from django.conf.urls import patterns, include, url | |
from django.views.generic.simple import redirect_to | |
from tierraadentro.login_view import LoginView | |
from django.contrib import admin | |
admin.autodiscover() | |
urlpatterns = patterns('tierraadentro.views', | |
url(r'^$', 'index'), | |
url(r'^login/$', 'login_user'), | |
url(r'^login-error/$', 'login_error'), | |
url(r'^logout/$', 'log_out'), | |
url(r'^register/$', 'register'), | |
url(r'^edit-profile/$', 'edit_profile'), | |
url(r'^mi-tierra-adentro/$', 'mi_tierra_adentro'), | |
url(r'^facebook-login/$', 'facebook_login'), | |
url(r'^video/(?P<video_id>\d+)/$', 'video'), | |
url(r'^login/$', 'login_user'), | |
######### AGREGUE ESTA LINEA | |
url(r'^login2/', LoginView.as_view()), | |
######### | |
) | |
urlpatterns += patterns('', | |
url(r'', include('social_auth.urls')), | |
url(r'^social-auth-login/$', redirect_to, {'url' : '/social-auth-login/facebook'}), | |
# Uncomment the admin/doc line below to enable admin documentation: | |
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | |
# Uncomment the next line to enable the admin: | |
url(r'^admin/', include(admin.site.urls)), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment