Now I can say for sure: Andrews Agyemang Opoku! You don't understand django orm completely! Here's why:
1. Please you are missing the whole point of why .get is used as opposed to .filter when getting record with "unique" constraint. Most likely, you've never worked with a large database where query optimisation is important.
Try to compare RAW SQL QUERY of these two methods:
```
from accounts.models import Account
from django.db import connection
Account.objects.get(pk=5)
print('get', connection.queries)[-1]
{'sql': 'SELECT "accounts_account"."id", "accounts_account"."password", "accounts_account"."last_login", "accounts_account"."is_superuser", "accounts_account"."first_name", "accounts_account"."last_name", "accounts_account"."is_staff", "accounts_account"."is_active", "accounts_account"."date_joined", "accounts_account"."email", "accounts_account"."phone" FROM "accounts_account" WHERE "accounts_account"."id" = 5 LIMIT 21', 'time': '0.000'}
```
```
Account.objects.filter(pk=5).first()
print('first', connection.queries)[-1]
{'sql': 'SELECT "accounts_account"."id", "accounts_account"."password", "accounts_account"."last_login", "accounts_account"."is_superuser", "accounts_account"."first_name", "accounts_account"."last_name", "accounts_account"."is_staff", "accounts_account"."is_active", "accounts_account"."date_joined", "accounts_account"."email", "accounts_account"."phone" FROM "accounts_account" WHERE "accounts_account"."id" = 5 ORDER BY "accounts_account"."id" ASC LIMIT 1', 'time': '0.000'}
```
This means. We have two identical queries in the database! PK is unique.
BUT:
the .get() method query tries to get 25 objects (limit 25), that means if your Where suggestion is wrong, you will get 25 objects.
the .first() method query tries to get only 1 object (limit 1), that means if your Where sentence is wrong, you will get 1 object.
Getting 1 object is always faster than getting 25 objects.
ORM always sends a query to the database.
It doesn't matter .get, .first or .last.
It doesn't matter if the field is unique or not in the where statement.
It doesn't matter if you have 100 rows or 65 million rows in your database.
2. You are right, I forgot the .filter() method before .last() or .first().
.get() is slower than the .first(), I've already mentioned that. Please tell me how else can I get a user with the unique name 'axxxa' from the database? Any suggestions?