Michel Thadeu Sabchuk wrote:
> Hi guys!
>
> I'm having troubles using admin interface to add an inline object that
> have a unique constraint in it. Look the code:
>
> class Office(Model):
>
>     name = CharField(maxlength=200)
>
>     def website(self):
>         return self.office_set.all()[0]
>
>     def __str__(self):
>         return self.name
>
>     class Admin:
>         pass
>
> class WebSite(Model):
>
>     office = ForeignKey(Office, edit_inline=STACKED, num_in_admin=1,
> max_num_in_admin=1)
>     host_name = CharField(maxlength=64, unique=True, core=True)
>
>     def __str__(self):
>         return self.host_name
>
>
> I didn't use the OneToOneField in this case because I can't edit the
> objects on the admin interface (I can add it, but can't edit).

I am personally working with OneToOne fields because those offer
better functioality (so you can have Office relation on Website, and
Website in Office). I am using it with my patch:
http://code.djangoproject.com/ticket/3188

> Anyway,
> OneToOneField will be rewritten :D, so no problem.

If it will be, I will change my code accordingly.

Alex


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