Skip to content

Commit

Permalink
Added an app to test categories against
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed Feb 1, 2010
1 parent 487a0a4 commit 486ffec
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions sample/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
'categories',
'editor',
'mptt',
'simpletext',
)
EDITOR_MEDIA_PATH = '/static/editor/'
CATEGORIES_ALLOW_SLUG_CHANGE = True
Empty file added sample/simpletext/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions sample/simpletext/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from models import SimpleText
from django.contrib import admin

admin.site.register(SimpleText)
31 changes: 31 additions & 0 deletions sample/simpletext/models.py
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions sample/simpletext/tests.py
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions sample/simpletext/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your views here.

0 comments on commit 486ffec

Please sign in to comment.