[Hejes-devel] [928] blog/manage: added links to categories/posts tables; removed registration link; added static/blog folder for image uploading

hejes-devel at nytud.hu hejes-devel at nytud.hu
Tue Sep 10 16:45:47 CEST 2013


Revision: 928
Author:   mihaltz
Date:     2013-09-10 16:45:46 +0200 (Tue, 10 Sep 2013)
Log Message:
-----------
blog/manage: added links to categories/posts tables; removed registration link; added static/blog folder for image uploading

Modified Paths:
--------------
    trunk/web2py/applications/helyesiras_webdev/controllers/blog.py
    trunk/web2py/applications/helyesiras_webdev/databases/storage.sqlite
    trunk/web2py/applications/helyesiras_webdev/models/db.py
    trunk/web2py/applications/helyesiras_webdev/views/blog/manage.html

Added Paths:
-----------
    trunk/web2py/applications/helyesiras_webdev/static/blog/

Modified: trunk/web2py/applications/helyesiras_webdev/controllers/blog.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/controllers/blog.py	2013-09-10 09:43:31 UTC (rev 927)
+++ trunk/web2py/applications/helyesiras_webdev/controllers/blog.py	2013-09-10 14:45:46 UTC (rev 928)
@@ -72,10 +72,19 @@
 
 @auth.requires_login()
 def manage():
-  """Show an SQLFORM.smartgrid to manage dbblog.posts
+  """Show an SQLFORM.smartgrid to manage dbblog.posts or .categories.
+     With no arguments, posts is the default, otherwise generate smartgrid for table args[0].
   """
-  grid = SQLFORM.grid(dbblog.posts, orderby=~dbblog.posts.created_on)
-  return dict(grid=grid)
+  if len(request.args) == 0:
+    request.args.append('posts')
+  table = request.args[0]
+  if table == 'posts':
+    grid = SQLFORM.grid(dbblog[table], orderby=~dbblog.posts.created_on, args=request.args[:1])
+  elif table == 'categories':
+    grid = SQLFORM.grid(dbblog[table], args=request.args[:1])
+  else:
+    redirect(URL('error'))
+  return locals()
   
 
 def feed():

Modified: trunk/web2py/applications/helyesiras_webdev/databases/storage.sqlite
===================================================================
(Binary files differ)

Modified: trunk/web2py/applications/helyesiras_webdev/models/db.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/models/db.py	2013-09-10 09:43:31 UTC (rev 927)
+++ trunk/web2py/applications/helyesiras_webdev/models/db.py	2013-09-10 14:45:46 UTC (rev 928)
@@ -52,6 +52,9 @@
 auth.settings.registration_requires_approval = False
 auth.settings.reset_password_requires_verification = True
 
+# disable registration (MM)
+auth.settings.actions_disabled.append('register')
+
 ## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
 ## register with janrain.com, write your domain:api_key in private/janrain.key
 #from gluon.contrib.login_methods.rpx_account import use_janrain

Modified: trunk/web2py/applications/helyesiras_webdev/views/blog/manage.html
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/views/blog/manage.html	2013-09-10 09:43:31 UTC (rev 927)
+++ trunk/web2py/applications/helyesiras_webdev/views/blog/manage.html	2013-09-10 14:45:46 UTC (rev 928)
@@ -2,10 +2,24 @@
 
 <div id="blog_manage">
 
+  {{if len(request.args) == 0 or request.args[0] == 'posts':}}
+
   <h1>Blogbejegyzések szerkesztése</h1>
+  <div>
+    <a href="{{=URL(c='blog', f='index')}}" target="_blank">Blog megnyitása új ablakban</a>  |  
+    <a href="{{=URL('blog', 'manage', args=['categories'])}}">Kategóriák szerkesztése >></a>
+  </div>
+ 
+  {{elif len(request.args) > 0 and request.args[0] == 'categories':}}
 
-  <div><a href="{{=URL(c='blog', f='index')}}" target="_blank">Blog megnyitása új ablakban</a></div>
+  <h1>Kategóriák szerkesztése</h1>
+  <div>
+    <a href="{{=URL(c='blog', f='index')}}" target="_blank">Blog megnyitása új ablakban</a>  | 
+    <a href="{{=URL('blog', 'manage', args=['posts'])}}">Bejegyzések szerkesztése >></a>
+  </div>
 
+  {{pass}}
+
   {{=grid}}
 
 </div>




More information about the Hejes-devel mailing list