cvetkoff / instant-press

Automatically exported from code.google.com/p/instant-press
GNU General Public License v2.0
0 stars 0 forks source link

Category change #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create article
2. Change category
3. Error: "Id doesnt exist"

What is the expected output? What do you see instead?
The expected output is the category changed. I see de error: id doesnt exist.

What version of the product are you using? On what operating system?
I'm using alpha3

Please provide any additional information below.
I've seen your database structure and I recommend the following:

db.define_table('posts',                                  
                  db.Field('id', 'id'),
                  db.Field('name', 'string', length=255, default="",requires=(IS_SLUG())), 
                  db.Field('title', 'string', length=255, required=True),                                      
                  db.Field('description', 'text', default=""),
                  db.Field('text_slice', 'text', default=""),
                  db.Field('category_id', db.categories,\
                                          required=True,\
                                          requires=IS_IN_DB(db,db.categories.id,'%(name)s')),
                  db.Field('keywords', 'text', default=""),                  
                  db.Field('created_on', 'datetime', default=datetime.datetime.today()),
                  db.Field('published_on', 'datetime', default=datetime.datetime.today()),
                  db.Field('updated_on', 'datetime', default=datetime.datetime.today()),
                  db.Field('created_by_id', 'integer', required=True),
                  db.Field('updated_by_id', 'integer', required=True),                                      
                  db.Field('published', 'integer', default=0, required=True),
                  db.Field('is_page', 'integer', default=0, required=True),
                  db.Field('page_order', 'integer', default=0),                    

And the categorieslist table elimination.

If you want the list of articles by category you can do the following:

articles = db(db.posts.category_id == [Category id that you 
want]).select(db.posts.id,db.post.title,[all the fields that you want to 
select])

Original issue reported on code.google.com by gmaggiw@gmail.com on 22 Aug 2010 at 1:35

GoogleCodeExporter commented 8 years ago
I rewrite all the category code, next week in alpha 4. 

Original comment by mulone.m...@gmail.com on 26 Aug 2010 at 11:32

GoogleCodeExporter commented 8 years ago

Original comment by mulone.m...@gmail.com on 20 Oct 2010 at 2:20