if you have millions of entries in a mysql table, you often want to manipulate it with a hexadecimal primary key (in practice you do a md5(name)). The queries are then much faster.
Is there a way to do this with Django? If not, the usual int primary key isn't limitating? How to specify that y开发者_如何学JAVAou want a big integer?
You can use whatever you like as the primary key in Django. Just add primary_key=True
to the model arguments. E.g.
foo = models.CharField(max_length=36, primary_key=True)
Here are the Django docs on this topic.
Hope this helps.
精彩评论