Login restriction added on dashboard,account,slice_req. Readme: how to update db...
authorYasin <mohammed-yasin.rahman@lip6.fr>
Fri, 23 Aug 2013 22:40:20 +0000 (00:40 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Fri, 23 Aug 2013 22:40:20 +0000 (00:40 +0200)
README
portal/views.py

diff --git a/README b/README
index 175e65b..cadc88d 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-his file documents the contents of this module
+This file documents the contents of this module
 
 See the devel/ subdir for more devel-oriented doc.
 
@@ -219,3 +219,17 @@ that would reset all-static/ and all-templates/ for you from the other contents
 
 
 
+======== update django database to reflect changes in existing models without any migration system (e.g., south) =========
+
+$python manage.py reset <your_app>
+
+This will update the database tables for your app, but will completely destroy any data that existed in those tables. 
+If the changes you made to your app model do not break your old schema (for instance, you added a new, optional field) 
+you can simply dump the data before and reload it afterwards, like so:
+
+
+$python manage.py dumpdata <your_app> > temp_data.json
+$python manage.py reset <your_app>
+$python manage.py loaddata temp_data.json
+
+If your changes break your old schema this won't work - in which case tools like south or django evolution are great.
index 60e149c..16086c2 100644 (file)
@@ -27,6 +27,8 @@ from django.contrib              import messages
 from django.views.generic        import View
 from django.views.generic.base   import TemplateView
 from django.shortcuts            import render
+from django.utils.decorators     import method_decorator
+from django.contrib.auth.decorators import login_required
 
 from plugins.lists.simplelist    import SimpleList
 from plugins.hazelnut            import Hazelnut
@@ -48,6 +50,11 @@ import os, re
 
 class DashboardView(TemplateView):
     template_name = "dashboard.html"
+    
+    #This view requires login 
+    @method_decorator(login_required)
+    def dispatch(self, *args, **kwargs):
+        return super(DashboardView, self).dispatch(*args, **kwargs)
 
     def get_context_data(self, **kwargs):
         # We might have slices on different registries with different user accounts 
@@ -470,7 +477,7 @@ class DashboardView(TemplateView):
 # DEPRECATED #        return context
 
 
-
+@login_required
 # View for my_account form
 def my_account(request):
     return render(request, 'my_account.html', {
@@ -530,7 +537,7 @@ class PlatformsView(TemplateView):
         context.update(page.prelude_env())
 
         return context
-
+@login_required
 #my_acc form value processing
 def acc_process(request):
     # getting the user_id from the session [now hardcoded]
@@ -743,7 +750,7 @@ def contact(request):
 
     })
 
-
+@login_required
 def slice_request(request):
     if request.method == 'POST': # If the form has been submitted...
         form = SliceRequestForm(request.POST) # A form bound to the POST data