Added an app to test categories against

This commit is contained in:
Corey Oordt 2010-02-01 10:29:15 -05:00
parent 487a0a4f23
commit 486ffec34f
6 changed files with 60 additions and 0 deletions

View file

@ -83,6 +83,7 @@ INSTALLED_APPS = (
'categories',
'editor',
'mptt',
'simpletext',
)
EDITOR_MEDIA_PATH = '/static/editor/'
CATEGORIES_ALLOW_SLUG_CHANGE = True

0
sample/simpletext/__init__.py Executable file
View file

View file

@ -0,0 +1,4 @@
from models import SimpleText
from django.contrib import admin
admin.site.register(SimpleText)

31
sample/simpletext/models.py Executable file
View file

@ -0,0 +1,31 @@
from django.db import models
# Create your models here.
class SimpleText(models.Model):
"""
(SimpleText description)
"""
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
class Meta:
verbose_name_plural = 'Simple Text'
ordering = ('-created',)
def __unicode__(self):
return self.name
# If using the get_absolute_url method, put the following line at the top of this file:
from django.db.models import permalink
@permalink
def get_absolute_url(self):
return ('simpletext_detail_view_name', [str(self.id)])
import categories
categories.register_fk(SimpleText, 'primary_category', {'related_name':'simpletext_primary_set'})
categories.register_m2m(SimpleText, 'cats')

23
sample/simpletext/tests.py Executable file
View file

@ -0,0 +1,23 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

1
sample/simpletext/views.py Executable file
View file

@ -0,0 +1 @@
# Create your views here.