In my app I have a model, "Review," that uses a different (ForeignKey)
citation form depending on the type of thing I'm reviewing. I'd like
to be able to call a different ForeignKey dynamically based on the
citation type but keep running into a bunch of errors.

Here's my current "Review" model code, which I'd like to "unkludge":

----------------
from myproject.citations.models import Book, Movie, Music, Other

class Review(models.Model):
        title = models.CharField(maxlength=200)
        pub_date = models.DateTimeField('publication date')
        summary = models.CharField(maxlength=250)
        body = models.TextField(help_text='Use Markdown.')
        slug = models.SlugField(prepopulate_from=('title',),
unique_for_date='pub_date')
        is_public = models.BooleanField('published', default=True)
#### Can I merge these?
        book_citation = models.ForeignKey(Book, null=True)
        movie_citation = models.ForeignKey(Movie, null=True)
        music_citation = models.ForeignKey(Music, null=True)
        other_citation = models.ForeignKey(Other, null=True)
####
        objects = models.Manager()
        topics = models.ManyToManyField(Topic, 
filter_interface=models.HORIZONTAL)
-------------------

Since I'm only reviewing one thing in each Review, it'd be possible to
change ForeignKey to OneToOneField, but (aside from likely changes to
the way Django handles one-to-one relationships), that doesn't change
my predicament.

I'd appreciate any help you can offer!

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to