def download(filename): if 'is_admin' in session: if (request.method == "POST"): return Upload(filename) else: return serve_a(filename) else: if request.method == "POST": return upload_nonadmin() else: return serve_na(filename)
def hello(): if 'is_admin' in session: if (request.method == "POST"): return Upload("home/pandey/") else: return files_a() else: if request.method == "POST": return upload_nonadmin() else: return files_na()
view_func=Signin.as_view("Signin"), methods=["POST"]) app.add_url_rule("/appointment", view_func=Appointment.as_view("Appointment"), methods=["GET", "POST", "PUT", "DELETE"]) app.add_url_rule("/account", view_func=Account.as_view("Account"), methods=["GET", "PUT"]) app.add_url_rule("/students", view_func=Students.as_view("Students"), methods=["GET"]) app.add_url_rule("/<int:id>", view_func=Data.as_view("Data"), methods=["GET", "POST", "PUT"]) app.add_url_rule("/upload", view_func=Upload.as_view("Upload"), methods=["GET", "POST", "PUT"]) app.add_url_rule("/advisor", view_func=Advisor.as_view("Advisor"), methods=["GET", "POST", "PUT"]) app.add_url_rule("/adminStudent", view_func=adminStudent.as_view("adminStudent"), methods=["GET", "POST", "PUT"]) # creating the authentication object auth = HTTPBasicAuth() user = "" #get the password of the given username and if there is such correct record perform login process
from django.conf.urls import patterns, url from views import Upload urlpatterns = patterns('', url(r'^upload/$', Upload.as_view(), name='upload'), )
from django.conf.urls.defaults import patterns, include, url from views import ChildrenView, NodeView, MoveItems, NodeItemView, MoveNode,Upload,LoadPath urlpatterns = patterns('', (r'^getChildrenOf/(?P<pk>\d+)/$', ChildrenView.as_view(), {}, "children_node_view"), (r'^getRoot/$', ChildrenView.as_view(), {}, "root_nodes_view"), (r'^loadPath/$', LoadPath.as_view(), {}, "path_nodes_view"), (r'^node/(?P<pk>\d*)/?$', NodeView.as_view(), {}, "node_view"), (r'^items/(?P<pk>\d*)/?$', NodeItemView.as_view(), {}, "node_item_view"), (r'^moveitems/?$', MoveItems.as_view(), {}, "node_moveitems_view"), (r'^movenode/?$', MoveNode.as_view(), {}, "node_movenode_view"), (r'^upload/?$', Upload.as_view(), {}, "item_upload"), )