My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 18, 2008 by mdenneb...@gmail.com
Labels: Featured
ModelExample  

Example model implementation

Here is an example of a model that derives from ActsAsList. It also defines the optional scope logic so you can store multiple scoped lists in a single table.

from django.db import models
from acts_as_list import ActsAsList

class Listitem(ActsAsList, models.Model):
    #some text
    title = models.CharField()

    # List scope column
    section = models.CharField(max_length=255)
    
    # Defines query logic to add list scope condition
    def scope_condition(self):
        return Q(section__exact=self.section)

Sign in to add a comment
Hosted by Google Code