The relationship you've set up - one template can have many associated
documents, do I understand correctly? So every document will have a
reference to the Template that it's associated with. If that's the case,
you've only set it up for one template per Document. A default doesn't make
sense in that case.

If I've misunderstood and inverted your plan, then each template will have a
reference to a single document. In that case I'd consider a reference to a
default Template in the Document (foreignKey) that was labelled "default".
You wouldn't want an "is_default" on the Template because each document
could have a different one, and the references would quickly become
confused.

-joe

On 2/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Hi community,
>
> For a smallish app, I want to manage document templates (model: Template)
> for
> documents (model: Document).
> Template has a foreign key on Document (many to one relationship).
>
> Now, I want a default Template per Document.
> How would I do that?
>
> I thought of various implementations:
> - having a field 'is_default' on model Template?
> - using OneToOne relationship (though documentation advises not to use
> that)?
> - ... ?
>
> What would you suggest?
> What is the most beautiful (djangotic/pythonic) way to implement this
> "default"
> Template for Document, and why?
>
> Thanks in advance.
>
> >
>

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