view examples/project/zoo/models.py @ 11:9af906a73061

added a 404.html file and updated the testcases to run against Django svn rev 8693 (post 1.0b1)
author Victor Ng <victor@monkeybean.ca>
date Fri, 29 Aug 2008 00:46:22 -0400
parents 8d0793b2358b
children
line wrap: on
line source

from django.db import models

"""
Module-level doctest.

    >>> Zoo
    <class 'project.zoo.models.Zoo'>
    >>> 1 + 1
    2
"""

def func():
    """
    Function-level test
        >>> 1+3
        4
    """
    pass
# Create your models here.
class Zoo(models.Model):
    """
    Class-level doctest

    >>> Zoo
    <class 'project.zoo.models.Zoo'>
    >>> 1 + 1
    2
    >>> Zoo.objects.all()
    []
    >>> z = Zoo(name='Bronx')
    >>> z.save()
    >>> z
    <Zoo: Bronx>
    >>> Zoo.objects.all()
    [<Zoo: Bronx>]
    """
    name = models.CharField(max_length=100)

    def __str__(self):
        """
        Function in class test
        >>> 1 + 2
        3
        """
        return self.name