Is it a major flaw if I'm querying my user's information by their user_id
(string
) rather than creating a Profile
model and linking them to other models using SQL relationships?
Example 1: (user_id
is stored in django sessions.)
class Information(models.Model):
user_id = models.CharField(...)
...
# also applies for .filter() operations.
information = Information.objects.get(user_id=request.getUser['user_id'])
note: I am storing the user's profile informations on Auth0.
Example 2: (user_id
is stored in Profile
.)
class Profile(models.Model):
user_id = models.CharField(...)
class Information(models.Model):
profile = models.ForeginKey(Profile, ...)
...
information = Information.objects.get(profile=request.getProfile)
note: With this method Profile will only have one field,
user_id
.
On Django, will using a string instead of a query object affect performances to retrieve items?