add BenchCoach user/profile

This commit is contained in:
2021-12-13 07:25:39 -06:00
parent f19a9ee67d
commit 7378fe1750
14 changed files with 235 additions and 1 deletions

14
benchcoach/models.py Normal file
View File

@@ -0,0 +1,14 @@
from django.db import models
from teamsnap.models import User as TeamsnapUser
from django.contrib.auth.models import User
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT / user_<id>/<filename>
return 'benchcoach/static/user_files/user_{0}/{1}'.format(instance.user.id, filename)
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
teamsnap_access_token = models.CharField(null=True, max_length=50)
teamsnap_user = models.ForeignKey(TeamsnapUser, on_delete=models.CASCADE, null=True)
avatar = models.ImageField(upload_to="avatar", null=True, blank=True)