Removed penfield's reliance on the Titled model and marked it as deprecated.
[philo.git] / philo / contrib / penfield / models.py
index a03bed8..a3e3186 100644 (file)
@@ -1,3 +1,5 @@
+from datetime import date, datetime
+
 from django.conf import settings
 from django.conf.urls.defaults import url, patterns, include
 from django.contrib.sites.models import Site, RequestSite
@@ -9,13 +11,14 @@ from django.utils import feedgenerator, tzinfo
 from django.utils.datastructures import SortedDict
 from django.utils.encoding import smart_unicode, force_unicode
 from django.utils.html import escape
-from datetime import date, datetime
+
 from philo.contrib.penfield.exceptions import HttpNotAcceptable
 from philo.contrib.penfield.middleware import http_not_acceptable
 from philo.contrib.penfield.validators import validate_pagination_count
 from philo.exceptions import ViewCanNotProvideSubpath
-from philo.models import Tag, Titled, Entity, MultiView, Page, register_value_model, TemplateField, Template
+from philo.models import Tag, Entity, MultiView, Page, register_value_model, TemplateField, Template
 from philo.utils import paginate
+
 try:
        import mimeparse
 except:
@@ -294,7 +297,13 @@ class FeedView(MultiView):
                abstract=True
 
 
-class Blog(Entity, Titled):
+class Blog(Entity):
+       title = models.CharField(max_length=255)
+       slug = models.SlugField(max_length=255)
+       
+       def __unicode__(self):
+               return self.title
+       
        @property
        def entry_tags(self):
                """ Returns a QuerySet of Tags that are used on any entries in this blog. """
@@ -309,7 +318,9 @@ class Blog(Entity, Titled):
 register_value_model(Blog)
 
 
-class BlogEntry(Entity, Titled):
+class BlogEntry(Entity):
+       title = models.CharField(max_length=255)
+       slug = models.SlugField(max_length=255)
        blog = models.ForeignKey(Blog, related_name='entries', blank=True, null=True)
        author = models.ForeignKey(getattr(settings, 'PHILO_PERSON_MODULE', 'auth.User'), related_name='blogentries')
        date = models.DateTimeField(default=None)
@@ -322,6 +333,9 @@ class BlogEntry(Entity, Titled):
                        self.date = datetime.now()
                super(BlogEntry, self).save(*args, **kwargs)
        
+       def __unicode__(self):
+               return self.title
+       
        class Meta:
                ordering = ['-date']
                verbose_name_plural = "blog entries"
@@ -559,14 +573,20 @@ class BlogView(FeedView):
                return [tag.name for tag in item.tags.all()]
 
 
-class Newsletter(Entity, Titled):
-       pass
+class Newsletter(Entity):
+       title = models.CharField(max_length=255)
+       slug = models.SlugField(max_length=255)
+       
+       def __unicode__(self):
+               return self.title
 
 
 register_value_model(Newsletter)
 
 
-class NewsletterArticle(Entity, Titled):
+class NewsletterArticle(Entity):
+       title = models.CharField(max_length=255)
+       slug = models.SlugField(max_length=255)
        newsletter = models.ForeignKey(Newsletter, related_name='articles')
        authors = models.ManyToManyField(getattr(settings, 'PHILO_PERSON_MODULE', 'auth.User'), related_name='newsletterarticles')
        date = models.DateTimeField(default=None)
@@ -579,6 +599,9 @@ class NewsletterArticle(Entity, Titled):
                        self.date = datetime.now()
                super(NewsletterArticle, self).save(*args, **kwargs)
        
+       def __unicode__(self):
+               return self.title
+       
        class Meta:
                get_latest_by = 'date'
                ordering = ['-date']
@@ -588,11 +611,16 @@ class NewsletterArticle(Entity, Titled):
 register_value_model(NewsletterArticle)
 
 
-class NewsletterIssue(Entity, Titled):
+class NewsletterIssue(Entity):
+       title = models.CharField(max_length=255)
+       slug = models.SlugField(max_length=255)
        newsletter = models.ForeignKey(Newsletter, related_name='issues')
        numbering = models.CharField(max_length=50, help_text='For example, 04.02 for volume 4, issue 2.')
        articles = models.ManyToManyField(NewsletterArticle, related_name='issues')
        
+       def __unicode__(self):
+               return self.title
+       
        class Meta:
                ordering = ['-numbering']
                unique_together = (('newsletter', 'numbering'),)