Im have troubling figuring about a good solution for blog posts. I
have created a ABC called Entry which Post, Link, Photo, Quote
inherit.

I first tired it with MTI and set Entry.objects.all() as the queryset
attribute. This will pass the list of Entry's to the template which I
can iterate over. However I would like to style each type of Entry
object a little different. Is there a way to know which type of Entry
you are dealing with.

Then I tried ABC with the same models. Obviously including abstract
True to the Base Entry class. With this approach I have know idea  how
to get a query set for all of these objects.

This seems like a fairly common use-case, so if anyone has any ideas I
would appreciate it. Im wide open if there is an approach that makes
more sense for this.

Below is my sample model:

class Entry(models.Model):
    title = models.CharField(_('title'), max_length=100,
unique_for_date="publish_on")
    published_on = models.DateTimeField(_('published on'))


class Post(Entry):
    slug = models.SlugField(_('slug'))
    teaser = models.TextField(_('teaser'), blank=True, null=False)
    body = models.TextField(_('body'), blank=True, null=False)


class Link(Entry):
    uri = models.CharField(_('uri'), max_length=200)
    summery = models.TextField(_('summery'), blank=True, null=False)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to