djangosnippets.org: Latest snippets posted by bernie2004https://djangosnippets.org/users/bernie2004/2009-04-04T05:36:12.713954-05:00bernie2004get next mysql autoincrement value
2009-04-04T05:36:12.713954-05:00bernie2004https://djangosnippets.org/snippets/1415/<p>i use this to get the pk of a record before creation,
in my scenario to name an uploaded image:
</p>
<pre><code>def UPLOADTO( i,n ):
if not i.id:
id = get_nextautoincrement( i.__class__ )
else:
id = i.id
return str(id)+'.jpg'
</code></pre>
Freely redistributable