Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop using mptt.register and deprecated/unused AlreadyRegistered exception in sample model #2146

Merged
merged 1 commit into from Aug 8, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 6 additions & 10 deletions cms/test_utils/project/sampleapp/models.py
Expand Up @@ -2,28 +2,24 @@
from cms.utils.compat.dj import python_2_unicode_compatible
from django.core.urlresolvers import reverse
from django.db import models
import mptt
from mptt.models import MPTTModel


@python_2_unicode_compatible
class Category(models.Model):
class Category(MPTTModel):
parent = models.ForeignKey('self', blank=True, null=True)
name = models.CharField(max_length=20)
description = PlaceholderField('category_description', 600)

def __str__(self):
return self.name

def get_absolute_url(self):
return reverse('category_view', args=[self.pk])

class Meta:
verbose_name_plural = 'categories'

try:
mptt.register(Category)
except mptt.AlreadyRegistered:
pass


class Picture(models.Model):
image = models.ImageField(upload_to="pictures")
Expand Down