Have a look at this post: 
http://stackoverflow.com/questions/3123796/how-to-make-an-auto-filled-and-auto-incrementing-field-in-django-admin
 
They determine the next value by calling a function called number(). In 
your case it would look something like this:

class Cliente(models.Model):
>     """This is the client data model, it holds all client information. This
>        docstring has to be improved."""
>     def number():
>         no = Cliente.objects.all().aggregate(Max(order))
>         if no == None:
>             return 1
>         else:
>             return no + 1
>
>     clientcode = models.IntegerField(_('Code'), max_length=6, unique=True, 
> \
>     default=number)
>
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to