mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Added an app to test categories against
This commit is contained in:
parent
487a0a4f23
commit
486ffec34f
6 changed files with 60 additions and 0 deletions
|
|
@ -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
0
sample/simpletext/__init__.py
Executable file
4
sample/simpletext/admin.py
Normal file
4
sample/simpletext/admin.py
Normal 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
31
sample/simpletext/models.py
Executable 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
23
sample/simpletext/tests.py
Executable 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
1
sample/simpletext/views.py
Executable file
|
|
@ -0,0 +1 @@
|
|||
# Create your views here.
|
||||
Loading…
Reference in a new issue