[Hejes-devel] [967] blog: added new db column categories. showing + modified controller to show only these

hejes-devel at nytud.hu hejes-devel at nytud.hu
Tue Oct 8 16:31:35 CEST 2013


Revision: 967
Author:   root
Date:     2013-10-08 16:31:35 +0200 (Tue, 08 Oct 2013)
Log Message:
-----------
blog: added new db column categories.showing + modified controller to show only these

Modified Paths:
--------------
    trunk/web2py/applications/helyesiras_webdev/controllers/blog.py
    trunk/web2py/applications/helyesiras_webdev/databases/blog_categories.table
    trunk/web2py/applications/helyesiras_webdev/databases/sql.log
    trunk/web2py/applications/helyesiras_webdev/databases/storage.sqlite
    trunk/web2py/applications/helyesiras_webdev/models/dbblog.py
    trunk/web2py/applications/helyesiras_webdev/progress.log

Modified: trunk/web2py/applications/helyesiras_webdev/controllers/blog.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/controllers/blog.py	2013-10-08 13:45:40 UTC (rev 966)
+++ trunk/web2py/applications/helyesiras_webdev/controllers/blog.py	2013-10-08 14:31:35 UTC (rev 967)
@@ -26,7 +26,7 @@
   """
   try:
     # all categories & tags for sidebar
-    cats = dbblog().select(dbblog.categories.ALL, orderby=dbblog.categories.ordering)
+    cats = dbblog(dbblog.categories.showing == True).select(orderby=dbblog.categories.ordering)
     tags = dbblog().select(dbblog.tags.ALL, orderby=dbblog.tags.name)
     # assemble query:  posts showing & filtered by category or tag specified via args
     query = (dbblog.posts.showing == True) & (dbblog.posts.category == dbblog.categories.id)
@@ -50,7 +50,8 @@
     # fetch desired rows
     posts = rset.select(orderby=~dbblog.posts.created_on, limitby=limitby)
     return dict(categories=cats, tags=tags, posts=posts, ntotal=ntotal, page=page, perpage=perpage)
-  except:
+  except Exception as e:
+    raise e
     global EXCEPTIONMSG
     response.flash = EXCEPTIONMSG
     return dict(categories=[], tags=[], posts=[], ntotal=0, page=1, perpage=5)
@@ -66,7 +67,7 @@
      tags: Rows object with all tag names and ids (for sidebar)
   """
   try:
-    cats = dbblog().select(dbblog.categories.ALL, orderby=dbblog.categories.ordering)
+    cats = dbblog(dbblog.categories.showing == True).select(orderby=dbblog.categories.ordering)
     tags = dbblog().select(dbblog.tags.ALL, orderby=dbblog.tags.name)
     slug = request.args(0)
     if slug == None: # no arg: redirect to index

Modified: trunk/web2py/applications/helyesiras_webdev/databases/blog_categories.table
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/databases/blog_categories.table	2013-10-08 13:45:40 UTC (rev 966)
+++ trunk/web2py/applications/helyesiras_webdev/databases/blog_categories.table	2013-10-08 14:31:35 UTC (rev 967)
@@ -2,64 +2,87 @@
 S'ordering'
 p2
 (dp3
-S'length'
+S'sortable'
 p4
-I255
-sS'unique'
+I2
+sS'sql'
 p5
-I01
-sS'sortable'
+S'INT UNIQUE'
 p6
-I2
-sS'sql'
+sS'length'
 p7
-S'INT UNIQUE'
+I255
+sS'notnull'
 p8
-sS'notnull'
+I00
+sS'unique'
 p9
-I00
+I01
 sS'type'
 p10
 S'integer'
 p11
-ssS'id'
+ssS'showing'
 p12
 (dp13
+S'length'
+p14
+I255
+sS'unique'
+p15
+I00
+sS'sortable'
+p16
+I2
+sS'sql'
+p17
+S'CHAR(1)'
+p18
+sS'notnull'
+p19
+I00
+sS'type'
+p20
+S'boolean'
+p21
+ssS'id'
+p22
+(dp23
 S'sortable'
-p14
+p24
 I1
 sS'sql'
-p15
+p25
 S'INT AUTO_INCREMENT NOT NULL'
-p16
+p26
 sS'length'
-p17
+p27
 I255
 sS'notnull'
-p18
+p28
 I00
 sS'unique'
-p19
+p29
 I00
 sS'type'
-p20
+p30
 S'id'
-p21
+p31
 ssS'name'
-p22
-(dp23
-g14
+p32
+(dp33
+g24
 I2
-sg15
+sg25
 S'VARCHAR(255) UNIQUE'
-p24
-sg17
+p34
+sg27
 I255
-sg18
+sg28
 I00
-sg19
+sg29
 I01
-sg20
+sg30
 S'string'
-p25
+p35
 ss.
\ No newline at end of file

Modified: trunk/web2py/applications/helyesiras_webdev/databases/sql.log
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/databases/sql.log	2013-10-08 13:45:40 UTC (rev 966)
+++ trunk/web2py/applications/helyesiras_webdev/databases/sql.log	2013-10-08 14:31:35 UTC (rev 967)
@@ -138,3 +138,6 @@
 timestamp: 2013-10-01T11:16:33.625946
 ALTER TABLE posts ADD showing CHAR(1);
 success!
+timestamp: 2013-10-08T16:13:16.522458
+ALTER TABLE categories ADD showing CHAR(1);
+success!

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

Modified: trunk/web2py/applications/helyesiras_webdev/models/dbblog.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/models/dbblog.py	2013-10-08 13:45:40 UTC (rev 966)
+++ trunk/web2py/applications/helyesiras_webdev/models/dbblog.py	2013-10-08 14:31:35 UTC (rev 967)
@@ -106,6 +106,7 @@
   )
 
 dbblog.define_table('categories',
+  Field('showing', 'boolean'),
   Field('ordering', 'integer', unique=True),
   Field('name', unique=True),
   format = '%(name)s',

Modified: trunk/web2py/applications/helyesiras_webdev/progress.log
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/progress.log	2013-10-08 13:45:40 UTC (rev 966)
+++ trunk/web2py/applications/helyesiras_webdev/progress.log	2013-10-08 14:31:35 UTC (rev 967)
@@ -928,3 +928,8 @@
 [2013-10-04 17:35:52] EDIT helyesiras_webdev/views/right_sidebar.html: 0
 [2013-10-04 17:36:10] EDIT helyesiras_webdev/views/right_sidebar.html: 0
 [2013-10-04 17:39:54] EDIT helyesiras_webdev/views/layout.html: 2
+[2013-10-08 16:13:12] EDIT helyesiras_webdev/models/dbblog.py: 1
+[2013-10-08 16:16:57] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2013-10-08 16:17:10] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2013-10-08 16:17:55] EDIT helyesiras_webdev/controllers/blog.py: 1
+[2013-10-08 16:19:30] EDIT helyesiras_webdev/controllers/blog.py: 0




More information about the Hejes-devel mailing list