示例#1
0
from django.conf.urls.defaults import patterns, url, include
from django.views.generic.simple import direct_to_template

from fhurl import fhurl
from core.forms import *

urlpatterns = patterns('core.views',
    #url for testing flat pages
    url(r'^html/(?P<filename>[\w-]+).html$', 'show_html'),

    url(r'^rate/(?P<eid>\w+)/$', 'rate'),
    url(r'^ajax-demo/$', 'ajax_demo'),

    fhurl(r'^fhurl/(?P<fid>\w+)/(?P<gid>\w+)/$', SampleFhurl, template="core/sample_form.html"),
    fhurl(r'^mfhurl/(?P<fid>\w+)/(?P<gid>\w+)/$', SampleModelFhurl, template="core/sample_form.html"),
    # url(r'^user/password_reset/$', 'django.contrib.auth.views.password_reset', name='admin_password_reset'),
    # url(r'^user/password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
    # url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
    # url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
)
示例#2
0
文件: urls.py 项目: jatinderjit/fhurl
    def save(self):
        return self.cleaned_data


class BothAjaxAndWeb(LoginFormWithRequest):
    def get_json(self, saved):
        return self.cleaned_data

    def save(self):
        return HttpResponse("hi %s" % self.cleaned_data["username"])


urlpatterns = patterns(
    '',
    fhurl("^login/without/$",
          LoginFormWithoutRequest,
          template="login.html",
          pass_request=False),
    fhurl("^login/with/$", LoginFormWithRequest, template="login.html"),
    fhurl("^with/http/$", FormWithHttpResponse, template="login.html"),
    fhurl("^with/variable/redirect/$",
          FormWithVariableRedirect,
          template="login.html"),
    fhurl("^with/data/(?P<username>.*)/$", WithURLData, template="login.html"),
    fhurl("^init/returning/(?P<username>.*)/$",
          InitReturningResponse,
          template="login.html"),
    fhurl("^init/raising/404/$", InitRaising404, template="login.html"),
    fhurl("^login/required/$",
          LoginFormWithRequest,
          template="login.html",
          require_login=True),
示例#3
0
文件: urls.py 项目: jatinderjit/fhurl
class AjaxOnly(LoginFormWithRequest):
    def save(self):
        return self.cleaned_data


class BothAjaxAndWeb(LoginFormWithRequest):
    def get_json(self, saved):
        return self.cleaned_data

    def save(self):
        return HttpResponse("hi %s" % self.cleaned_data["username"])


urlpatterns = patterns(
    "",
    fhurl("^login/without/$", LoginFormWithoutRequest, template="login.html", pass_request=False),
    fhurl("^login/with/$", LoginFormWithRequest, template="login.html"),
    fhurl("^with/http/$", FormWithHttpResponse, template="login.html"),
    fhurl("^with/variable/redirect/$", FormWithVariableRedirect, template="login.html"),
    fhurl("^with/data/(?P<username>.*)/$", WithURLData, template="login.html"),
    fhurl("^init/returning/(?P<username>.*)/$", InitReturningResponse, template="login.html"),
    fhurl("^init/raising/404/$", InitRaising404, template="login.html"),
    fhurl("^login/required/$", LoginFormWithRequest, template="login.html", require_login=True),
    fhurl(
        "^login/required/with/url/$",
        LoginFormWithRequest,
        template="login.html",
        require_login=True,
        login_url="/mylogin/",
    ),
    fhurl(
示例#4
0
文件: urls.py 项目: amitu/zums
from zums.zumsd_users.forms import LoginForm, EmailOptionalRegistrationForm
from django.contrib.auth import views as auth_views

import zums

from zums.signals import UserSignedOut

def logout_with_signal(request, *args, **kw):
    user, sessionid = request.user, request.session.session_key
    resp = auth_views.logout(request, *args, **kw)
    UserSignedOut.send(sender=zums, user=user, sessionid=sessionid)
    return resp

urlpatterns = patterns('zums.zumsd_users.views',
    fhurl(
        r'^login/$', template='zumsd_users/login.html',
        form_cls=LoginForm, next="/", name='auth_login'
    ),
    fhurl(
        r'^register/$', template='zumsd_users/register.html',
        form_cls=EmailOptionalRegistrationForm, next="/", name='auth_register'
    ),
    url(
        r'^logout/$', logout_with_signal,
        {'template_name': 'zumsd_users/logout.html'}, name='auth_logout'
    ),
    url(r'^whoami/$', 'whoami'),
    url(
        r'^password/change/$', auth_views.password_change,
        name='auth_password_change',
        kwargs={'template_name': "zumsd_users/password_change.html"}
    ),