1.各位是如何解决模板需要简单python语法的需求的.
我举个小例子, 我一个类似论坛的程序, 当用户访问其中一个帖子内容的时候, 可以看到该帖子的回复, 每20个回复为一页, 当用户访问第三页的时
候, 回复的编码应该是21-30, 但是在模板里, 我怎么做这个数字的加法呢? 目前想到的办法是, 返回当前页面的第一个回复的数字, 下面的用
add这个filter来加.不知道还有没有别的解决方案呢? (我能想到的就是换模板引擎和写一个自定义tag)
2.各位是如何解决数据表更改的问题的
Django的syncdb在第一次使用的时候, 其实是非常舒服的, 但是一旦我改了数据表的结构, 事情就没那么简单了(我知道一次性规划好数据库
结构是个很好的习惯和方法, 但是谁也不能保证数据库不会有大的变化), 再次使用syncdb的话, 数据库结构是不会有变化的, 如果只是在开发阶
段, 那么还好, 数据不要了, 我重新建库, 现在的问题是, 如果里面已经有了大量数据呢, 我怎么样能保证数据的完整性并迁向正确的数据结构
呢?
不知道大家是怎么解决这个问题的, 这2个问题困扰了我很久.
2009/11/9 忧郁王子 <myking...@gmail.com>:
2.看来也只能手动修改table了
On Nov 9, 4:42 pm, 诚子 <zhicheng1...@gmail.com> wrote:
> 这个我听说过,但从来没用过。
>
> 2009/11/9 @@ <ask...@gmail.com>
>
>
>
>
>
> > 在来推荐一次 souch :)http://south.aeracode.org/
>
> > 是用来解决第2个问题的。
>
> > South is <http://wiki/About>:
>
> > - *Intelligent*; it knows if you've missed out<http://wiki/About#MissingMigrations> a
> > migration or two
> > - *Database independent <http://wiki/About#DatabaseIndependence>*, so
> > there's no hassle if you need to move databases.
> > - Easy; it can *write migrations for you<http://wiki/About#AutomaticMigrationCreation>
> > *.
> > - Designed for a *pluggable Django world*; you can declare dependencies<http://wiki/Dependencies> between
> > apps so they all migrate together correctly, and you can still use syncdb
> > for your non-migrated apps without it interfering.
> > - Useful for *data too*; you can write migrations to transform legacy
> > data <http://wiki/Tutorial3>.
webpy也有webserver啊,好像是从cherrypy搞来的。
--
Best Regards,
Leo Jay
如果能用了翻页器,试试上面的代码。
On 11月9日, 下午3时42分, 忧郁王子 <mykinghea...@gmail.com> wrote: