Read, re-read and then ask a question ;-). So I'm answering my
question myself: Use the TransactionMiddleware to tie together the two
updates.

On Apr 29, 3:20 pm, mettwoch <mettw...@pt.lu> wrote:
> Hi,
>
> I'm rather new to Django (and webapp development) and I'd appreciate
> any advice on the following problem.
>
> I've a model named 'document' that can hold any kind of documents like
> customer invoices, supplier invoices, goods returned, ..., but I've to
> ensure that the customer invoices be numbered in sequence regardless
> of the fact that there may be one customer invoice entered in the
> system and then some supplier invoices and then again some customer
> invoices. I've also a model holding the 'document type'. That model
> could hold an Integer Field that is incremented at the creation of
> every document type separately, but that has to be done in a
> transaction together with the document creation:
>
> begin-transaction
>     document_type['customer invoice'].number += 1
>     d = document(number = document_type['customer invoice'].number,
> document_type = 'customer invoice', ...
>     ...
> end-transaction
>
> Is that kind of mechanism working? Do you have any other suggestion?
>
> Kind regards
> Marc
--~--~---------~--~----~------------~-------~--~----~
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