Re: Generate a daily serial/batch/lot number
On 06/09/10 19:09, kmpm wrote:
> Regarding UUIDs, one of the business requirements (which I don't
> control) is that the identifier that is to be used on barcodes and
> what not is to be in the format "YYMMDDXXXX" where XXXX is the number
> we are talking about. So UUID would be great and unique, as well would
> the automatic pk/id from the model itself as that is unique enough.
> But I need a rolling number per day and nothing else.
I can't see if you mentioned which database you are using, but if you
are using Postgres, why can't you just use the default PK field and run
a cronjob to excecute a postgres SETVAL at midnight?
#!/bin/sh
DATECODE=$( date +%Y%m%d )
echo "SET SETVAL('table_id_seq', '${DATECODE}0000');" | psql ....
Regards
Darryl
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home