Consider a bunch of substances and a bunch of papers written by various
researchers. Some of the papers apply to more than one substance and a
substance can have multiple papers. Here are the models ...
class Paper_Substance(models.Model):
paper = models.ForeignKey('Paper', null=True, blank=True)
substance = models.ForeignKey('Substance', null=True, blank=True)
reference = models.CharField(max_length=8, null=True, blank=True)
...
class Paper(models.Model):
papers = models.ManyToManyField('Substance', through='Paper_Substance')
...
title = models.CharField(max_length=200)
url = models.URLField(null=True, blank=True)
...
In the Admin I want to add none, one or more Papers to any Substance. I
can do this but I can only see the the content of Paper_Substance
records instead of Paper records. In particular I want to display the
URL of the paper. This is the admin snippet ...
class PapersInline(admin.StackedInline):
model = Paper.papers.through
fk_name = 'substance'
Is this possible?
Thanks heaps
Mike
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/524B4A60.8080201%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment