First commit
This commit is contained in:
commit
440f5a7df4
1563 changed files with 217996 additions and 0 deletions
16
users/models.py
Normal file
16
users/models.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
def user_avatar_path(instance, filename):
|
||||
return f'static/uploads/avatars/{instance.user.id}/{filename}'
|
||||
|
||||
class Profile(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
avatar = models.ImageField(upload_to=user_avatar_path, default='default.jpg')
|
||||
first_name = models.CharField(max_length=64, blank=True)
|
||||
last_name = models.CharField(max_length=64, blank=True)
|
||||
birth_date = models.DateField(null=True, blank=True)
|
||||
biography = models.TextField(blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
Loading…
Add table
Add a link
Reference in a new issue