| Name | MikeKJ |
|---|---|
| Email Address | n/a |
| Posts | 1 |
-
- 2012-01-27 10:57:36
- saving in a view
- Board » Django » Views
-
I have 2 models Count is purely an incremental counter a model called Sale, the reason for the Count models is to increment a reference for Sale and other models
In a view I get the latest sale and count then I want to save the incemented count (number) to Count also save number to Sale
customer = Sale.objects.all().order_by('-id').filter(email_address=email).distinct()0
this = Count.objects.all().order_by('-id')0
number = this.number + 1
a = this.save(force_insert=True)
ref = number
reference = number
name = customer.name
salutation = customer.salutation
b = customer.save(force_update=True)
I know the field names are rubbish but can anyone spot where I am going wrong please


