there are many ways of solving this problem.
please see the below thread for more details where similar problem was
discussed :
http://groups.google.com/group/django-users/browse_thread/thread/3a9960139307aaec/77b712ee9c08795b#77b712ee9c08795b
Another method which you can use is
====================================
for respective model override the save as follows
class Model():
#this code syntax may not be proper
def save(self):
super(self) #at this point it will save and you will know the id
self.account_number = "X"+self.id
self.save()
The syntax may be wrong as i have did not do it earlier
The core idea is to override the save and then call its parent to save
the object,after saving using that object id form account number
and save it again
On Feb 13, 12:54 pm, gganesh <[email protected]> wrote:
> hello ,
> i will be glad to find your help in the task mentioned below ,
> i need to create a account_number column which is a concat of id
> column and with some variable ,for example, if my id column is 1 ( id
> =1) and account_number should be X1(account_number=X1) and if my id is
> 2 the account_number must be X2 and so on
> thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---