This could also be done with Generic Relationships:
http://www.djangoproject.com/documentation/models/generic_relations/
I use this for similiar object references.  I also sometimes use
intermediary tables between the base model and the generic_relationship to
limit the types of objects that can be set.
-richard


On 5/23/08, Peter Rowell <[EMAIL PROTECTED]> wrote:
>
>
> > Thoughts on this approach?
>
> I do this all the time. I call them objrefs (Object References).
>
> My syntax is <app_name>.<model_name>.id. If the model_name is unique
> across the project (which is normally true), then <model_name>.id is
> also accepted. I also allow for <model_name>.id.<field_name>.
>
> I have three apps I am getting ready to post that make strong use of
> objrefs. One is a text scanner called SLML (Simple Link Markup
> Language) that allows content editors to embed links/references to
> other objects in the system. E.g. [[article.29]] yields a properly
> formatted link to Article 29, using the Article's default text (title
> or whatever) for the link text. There are many variations and options
> to this basic tag.
>
> The only downside to this is that you have a hard coded reference in
> your db/text. However, in all of the systems I've used this with, this
> has not caused even a single problem.
>
> >
>

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