-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an app to test categories against
- Loading branch information
Corey Oordt
committed
Feb 1, 2010
1 parent
487a0a4
commit 486ffec
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
"""} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your views here. |