There can be multiple associated Model2 objects to Model1, but without one
Model2  Model1 cannot exist.


Kristaps Kūlis
BOFH excuse #96: Vendor no longer supports the
product<http://wertarbyte.de/gigaset-rss/?limit=140&cookies=1&lang=de&lang=en&jar_id=10394735232565416737736263810940952>

On Sat, Oct 10, 2009 at 5:45 AM, Bayuadji <bayua...@gmail.com> wrote:

>
> On 10/9/09, Kristaps Kūlis <kristaps.ku...@gmail.com> wrote:
> > Hello
> >
> >  I have such models:
> >
> >  Class Model1(models.Model):
> >    [content]
> >  Class Model2(models.Model):
> >    model1 = models.ForeignKey(Model1)
> >
> >  How to ensure that Model1 has at least 1 referenced model ?
> > data are added using django admin interface, which inlineadmins
>
> Hi,
>
> How about using OneToOneField instead ForeignKey
> http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
>
> cheers
> -djibon-
>
> --
> --------------------------------------------------------------
> http://www.tumbletooth.org
> my linkedin profile : http://www.linkedin.com/in/bayuadji
> --------------------------------------------------------------
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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