Interpersonal Skills for Business Analyst

Interpersonal skills are the set of abilities that enable individuals to interact effectively with other people. These skills include a wide range of competencies such as communication, active…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to use UUID in Django ?

Universally Unique Identifiers, or UUIDS, are 128 bit numbers, composed of 16 octets and represented as 32 base-16 characters, that can be used to identify information across a computer system. using UUID for your project can make your site more professional and reliable because of that for the most part ID of your resources are not humanly guessable also its unique from any other resource’s ID in the internet.

Django by default Utilize an integer ID which starts from 1 and increases as much as your database’s table row goes. This can be good enough for development purpose but in production its not a good practice. its recommended to use UUID.

To use UUID in your model there is only two steps to follow :

See the following code example of Django model with UUID:

See the above Django model with UUID id field:

So by using the above two lines of code you can easily add UUID instead of the default Django’s Integer ID field.

Thanks for reading! Follow me for related topics

Add a comment

Related posts:

10 Principles for Good UX Design Documentation

During my time at Canonical, I was working on the Ubuntu mobile and desktop Software Development Kit (SDK) in a genuinely, open-sourced fashion. Team members were distributed across different…

This is the list of office cleaning materials you need to leave it spotless.

Do you know what office cleaning materials are? Undoubtedly, there are many people who work in an office and their daily traffic accumulates a huge amount of dirt. Keeping it clean is a necessity, so…

New Jobs Alert in Islamabad Police ASI Jobs 2022

The Islamabad Capital District Police was established on January 1, 1981, by Presidential Orders №17 and 18, 1980. Rule of law, security of property, and prevention of civil unrest. The purpose of…