Hi all,

I am worried about how to model the next scene (this is an example, but 
an appropriated one): In the model we have People, and there are 
different kind of people, let's say: Professors, Students and Other. 
Each People object has a 'type' attribute. Type can be P, S or O.

So far, all right.

Each people has an identifier that looks like: {LETTER}{NUMBER}. P1, P2, 
P3 and S1 are examples of valid identifiers.

When you instance a People object you know its type but not its number:

p = People(type="S")

The question is, how can I handle this numbers in my model? The count 
should be dependent of the type.

I am thinking about creating PostgreSQL sequences and use them to 
retrieve the propitiated number each time a People is instanced:

...
if type == "S":
        self.number = seq_wrapper_s.next()
elif typ == "P":
        self.number = seq_wrapper_p.next()
else:
        self.number = seq_wrapper_o.next()
...

But this will tie me to an specific data base engine. Is there a way of 
doing this task in Django in a independent-db-engine way?

Thanks in advance,

Juanjo
-- 
mi blog: http://www.juanjoconti.com.ar


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