一些问题涉及HTML5的sessionStorage:
我在另一个SO问题中找到了这个网站http://dev-test.nemikor.com/web-storage/support-test/,我想知道数据是否仍然相关?
我刚刚开始与Kohana一起玩,来自CodeIgniter和直接的php.我想知道为什么Kohana使用before()和after()函数而不是普通的构造函数和析构函数?
我最近在一本书中查看了一些代码,并在页面中查看了他们所拥有的页面:
<input type="submit" value="Add To Cart" name="submit" alt="Add To Cart" />
Run Code Online (Sandbox Code Playgroud)
我知道如果你使用图像作为按钮,输入就在那里.但有没有任何理由说明为什么它在这个例子中或者它们只是覆盖基础.
关于如何在Django中做到这一点,我有一个心理上的空白,希望你能提供帮助.
我有一个画廊表,我按类型过滤:
public_galleries = models.Gallery.objects.filter(type = 2).filter(root_gallery__isnull = True)
Run Code Online (Sandbox Code Playgroud)
但我还想看看特定用户的UserGallery表中是否存在该库.我有这个用户列表:
user_galleries = models.UserGallery.objects.select_related().filter(clientuser=request.user.id).filter(gallery__root_gallery__isnull = True)
Run Code Online (Sandbox Code Playgroud)
注意**刚刚开始将Django用于实际项目,因此对这两种语句的任何改进也表示赞赏.
编辑 - 模特:
class Gallery(models.Model):
"""Gallery model"""
name = models.CharField(u"Gallery name", max_length=120)
type = models.IntegerField(default=0, choices=TYPE_CHOICES)
root_gallery = models.ForeignKey("self", blank=True, null=True)
""" Other Fields"""
class UserGallery(models.Model):
"""Model to link Gallery and ClientUser"""
gallery = models.ForeignKey(Gallery)
clientuser = models.ForeignKey(ClientUser)
owner = models.BooleanField(default=False)
Run Code Online (Sandbox Code Playgroud)