Hi Malcolm,

Malcolm Tredinnick schrieb:
> On Wed, 2009-08-12 at 14:24 +0200, Thomas Guettler wrote:
>> Hi Malcolm and others,
>>
>> Malcolm Tredinnick schrieb:
> [...]
> 
>  
>>> You already have the content type table for referring to other model
>>> objects. Why not use that so that you can maintain some referential
>>> integrity?
>> Content Types use serial keys. Take something like a ticket system:
>> Serial keys are good for the tickets. But if you have something like a
>> TicketTypeModel it is not a good solution. The customer uses the live
>> system and can create new TicketTypes. But during the same time,
>> I might create new TicketTypes in my development system. The serial IDs 
>> clash.
> 
> Ah, ok. So you'll end up with something like your own version of the
> content type system. Makes sense. Providing your model names are going
> to be different from your customer's developed versions, your plan makes
> sense. 

It's a compliment for me, if you say "makes sense". Thank you.

I uploaded my implementation called ImportObject here:
http://www.djangosnippets.org/snippets/1681/

> This is the only reason I would be tempted not to just use the import
> path. You really want to namespace the identifiers and model names might
> clash if they're common enough.

The import path should be absolute. Example: myapp.models.MyModel or 
myapp.foo.MyPlainPythonClass.
Theses paths should be unique. The drawback is, that is harder to refactor 
code. You
need to modify the DB tables if you change the layout of the code.

If a customer needs a different class, you could add a hook somewhere to load 
it.

 Regards,
   Thomas

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

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