ForeignKey, Inline, and normal Admin interface

23 views
Skip to first unread message

Saikek

unread,
Jun 15, 2010, 1:43:11 AM6/15/10
to Django users
Hello *,

I've encountered a problem. I have a Match (football) which contains
relationship one-to-many with Goals.

class Match(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
...

class Goal(models.Model):
player = models.ForeignKey(Player)
moment = models.DateTimeField()
match = models.ForeignKey(Match)


What is the easiest\smartest way to enable adding Goals from Match
page ? I've read about Inline, but it doesnt works, because in this
way we will have loop import.

Thank you.

Kenneth Gonsalves

unread,
Jun 15, 2010, 8:04:30 AM6/15/10
to django...@googlegroups.com
On Tuesday 15 June 2010 11:13:11 Saikek wrote:
> What is the easiest\smartest way to enable adding Goals from Match
> page ? I've read about Inline, but it doesnt works, because in this
> way we will have loop import.
>

easiest way is to make a custom form covering both models, preferably outside
admin
--
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

Daniel Roseman

unread,
Jun 15, 2010, 8:11:00 AM6/15/10
to Django users
Why doesn't inline work? Why do you think you will have a loop import?
Be specific. After all this is the classic use case for inline admin
forms.
--
DR.
Reply all
Reply to author
Forward
0 new messages